public IntMapGraph(Int2ObjectMap<IntSet> map) { this.map = map; if (map.defaultReturnValue() == null || !map.defaultReturnValue().equals(IntSets.EMPTY_SET)) { LOGGER.warn("It is necessary to set default return value of the map as the empty set."); map.defaultReturnValue(IntSets.EMPTY_SET); } int maxNodeIndex = 0, numArcs = 0; for (Entry<IntSet> x : map.int2ObjectEntrySet()) { if (x.getIntKey() > maxNodeIndex) maxNodeIndex = x.getIntKey(); for (int succ : x.getValue()) { if (succ > maxNodeIndex) maxNodeIndex = succ; numArcs++; } } this.numArcs = numArcs; this.numNodes = maxNodeIndex+1; }
public IntCollection get(T key) { return map.getOrDefault(key, IntSets.EMPTY_SET); }
/** * Returns the nodes which are already expanded with the specified node. * * @param entry the id of the node for which the expansions should be returned * @return the nodes which are already expanded with the specified node */ public IntSet getExpanded(SpatialEntry entry) { IntSet exp = expanded.get(getPageID(entry)); return (exp != null) ? exp : IntSets.EMPTY_SET; }
/** * Returns the nodes which are already expanded with the specified node. * * @param entry the id of the node for which the expansions should be returned * @return the nodes which are already expanded with the specified node */ public IntSet getExpanded(DeLiCluNode entry) { IntSet exp = expanded.get(entry.getPageID()); return (exp != null) ? exp : IntSets.EMPTY_SET; }