private void propagatePhiUsageInformation() { IntDeque worklist = new IntArrayDeque(); for (int receiverIndex : phisByReceiver.keys().toArray()) { if (usedPhis.get(receiverIndex)) { worklist.addLast(receiverIndex); } } IntSet visited = new IntHashSet(); while (!worklist.isEmpty()) { int varIndex = worklist.removeFirst(); if (!visited.add(varIndex)) { continue; } usedPhis.set(varIndex); Phi phi = phisByReceiver.get(varIndex); if (phi != null) { for (Incoming incoming : phi.getIncomings()) { if (!visited.contains(incoming.getValue().getIndex())) { worklist.addLast(incoming.getValue().getIndex()); } } } } }
/** * beginning with startNode add all following nodes to LIFO queue. If node has been already * explored before, skip reexploration. */ @Override public void start(EdgeExplorer explorer, int startNode) { IntArrayDeque stack = new IntArrayDeque(); GHBitSet explored = createBitSet(); stack.addLast(startNode); int current; while (stack.size() > 0) { current = stack.removeLast(); if (!explored.contains(current) && goFurther(current)) { EdgeIterator iter = explorer.setBaseNode(current); while (iter.next()) { int connectedId = iter.getAdjNode(); if (checkAdjacent(iter)) { stack.addLast(connectedId); } } explored.add(current); } } }
public TarjansSCCAlgorithm(GraphHopperStorage ghStorage, final EdgeFilter edgeFilter, boolean ignoreSingleEntries) { this.graph = ghStorage; this.nodeStack = new IntArrayDeque(); this.onStack = new GHBitSetImpl(ghStorage.getNodes()); this.nodeIndex = new int[ghStorage.getNodes()]; this.nodeLowLink = new int[ghStorage.getNodes()]; this.edgeFilter = edgeFilter; if (ignoreSingleEntries) { // Very important case to boost performance - see #520. Exclude single entry components as we don't need them! // But they'll be created a lot for multiple vehicles because many nodes e.g. for foot are not accessible at all for car. // We can ignore these single entry components as they are already set 'not accessible' EdgeExplorer explorer = ghStorage.createEdgeExplorer(edgeFilter); int nodes = ghStorage.getNodes(); ignoreSet = new GHBitSetImpl(ghStorage.getNodes()); for (int start = 0; start < nodes; start++) { if (!ghStorage.isNodeRemoved(start)) { EdgeIterator iter = explorer.setBaseNode(start); if (!iter.next()) ignoreSet.add(start); } } } else { ignoreSet = new GHBitSetImpl(); } }
private void propagateNullness() { statuses = new Nullness[program.variableCount()]; IntDeque deque = new IntArrayDeque(); initNullness(deque);
/** * Create a new deque by pushing a variable number of arguments to the end of it. */ /* */ public static IntArrayDeque from(int... elements) { final IntArrayDeque coll = new IntArrayDeque(elements.length); coll.addLast(elements); return coll; } }
IntDeque queue = new IntArrayDeque(); for (BasicBlock block : program.getBasicBlocks()) { BitSet usedVars = getUsedVarsInBlock(livenessAnalyzer, block);
variableDefined = new boolean[program.variableCount()]; IntDeque stack = new IntArrayDeque(); stack.addLast(0); while (!stack.isEmpty()) {
public MaxDepthBetweennessCentrality(Graph graph, int maxDepth) { this.graph = graph; nodeCount = Math.toIntExact(graph.nodeCount()); this.maxDepth = maxDepth; this.centrality = new double[nodeCount]; this.stack = new IntStack(); this.depth = new IntArrayDeque(); this.sigma = new int[nodeCount]; this.distance = new int[nodeCount]; queue = new IntArrayDeque(); paths = new Path[nodeCount]; delta = new double[nodeCount]; }
public MaxDepthBetweennessCentrality(Graph graph, int maxDepth) { this.graph = graph; nodeCount = Math.toIntExact(graph.nodeCount()); this.maxDepth = maxDepth; this.centrality = new double[nodeCount]; this.stack = new IntStack(); this.depth = new IntArrayDeque(); this.sigma = new int[nodeCount]; this.distance = new int[nodeCount]; queue = new IntArrayDeque(); paths = new Path[nodeCount]; delta = new double[nodeCount]; }
/** * Create a new deque by pushing a variable number of arguments to the end of it. */ /* */ public static IntArrayDeque from(int... elements) { final IntArrayDeque coll = new IntArrayDeque(elements.length); coll.addLast(elements); return coll; } }
public BetweennessCentrality(Graph graph) { this.graph = graph; nodeCount = Math.toIntExact(graph.nodeCount()); this.centrality = new double[nodeCount]; this.stack = new IntStack(); this.sigma = new int[nodeCount]; this.distance = new int[nodeCount]; queue = new IntArrayDeque(); paths = new Path[nodeCount]; delta = new double[nodeCount]; }
public BetweennessCentrality(Graph graph) { this.graph = graph; nodeCount = Math.toIntExact(graph.nodeCount()); this.centrality = new double[nodeCount]; this.stack = new IntStack(); this.sigma = new int[nodeCount]; this.distance = new int[nodeCount]; queue = new IntArrayDeque(); paths = new Path[nodeCount]; delta = new double[nodeCount]; }
private BCTask() { this.paths = new Paths(); this.stack = new IntStack(); this.queue = new IntArrayDeque(); this.sigma = new int[nodeCount]; this.distance = new int[nodeCount]; this.delta = new double[nodeCount]; }
private BCTask() { this.paths = new Paths(); this.stack = new IntStack(); this.queue = new IntArrayDeque(); this.sigma = new int[nodeCount]; this.distance = new int[nodeCount]; this.delta = new double[nodeCount]; }
private BCTask() { this.paths = new IntObjectScatterMap<>(expectedNodeCount); this.stack = new IntStack(); this.queue = new IntArrayDeque(); this.sigma = new IntIntScatterMap(expectedNodeCount); this.delta = new IntDoubleScatterMap(expectedNodeCount); this.distance = new int[nodeCount]; }
private BCTask() { this.paths = new IntObjectScatterMap<>(expectedNodeCount); this.stack = new IntStack(); this.queue = new IntArrayDeque(); this.sigma = new IntIntScatterMap(expectedNodeCount); this.delta = new IntDoubleScatterMap(expectedNodeCount); this.distance = new int[nodeCount]; }
public ShortestPathDijkstra(Graph graph) { this.graph = graph; nodeCount = Math.toIntExact(graph.nodeCount()); costs = new IntDoubleScatterMap(); queue = SharedIntPriorityQueue.min( IntPriorityQueue.DEFAULT_CAPACITY, costs, Double.MAX_VALUE); path = new IntIntScatterMap(); visited = new BitSet(); finalPath = new IntArrayDeque(); finalPathCosts = new DoubleArrayDeque(); progressLogger = getProgressLogger(); }
public ShortestPathDijkstra(Graph graph) { this.graph = graph; nodeCount = Math.toIntExact(graph.nodeCount()); costs = new IntDoubleScatterMap(); queue = SharedIntPriorityQueue.min( IntPriorityQueue.DEFAULT_CAPACITY, costs, Double.MAX_VALUE); path = new IntIntScatterMap(); visited = new BitSet(); finalPath = new IntArrayDeque(); finalPathCosts = new DoubleArrayDeque(); progressLogger = getProgressLogger(); }
public ShortestPathAStar(final Graph graph, final GraphDatabaseAPI dbService) { this.graph = graph; this.dbService = dbService; nodeCount = Math.toIntExact(graph.nodeCount()); gCosts = new IntDoubleScatterMap(nodeCount); fCosts = new IntDoubleScatterMap(nodeCount); openNodes = SharedIntPriorityQueue.min( nodeCount, fCosts, Double.MAX_VALUE); path = new IntIntScatterMap(nodeCount); closedNodes = new SimpleBitSet(nodeCount); shortestPath = new IntArrayDeque(); progressLogger = getProgressLogger(); }
public ShortestPathAStar(final Graph graph, final GraphDatabaseAPI dbService) { this.graph = graph; this.dbService = dbService; nodeCount = Math.toIntExact(graph.nodeCount()); gCosts = new IntDoubleScatterMap(nodeCount); fCosts = new IntDoubleScatterMap(nodeCount); openNodes = SharedIntPriorityQueue.min( nodeCount, fCosts, Double.MAX_VALUE); path = new IntIntScatterMap(nodeCount); closedNodes = new SimpleBitSet(nodeCount); shortestPath = new IntArrayDeque(); progressLogger = getProgressLogger(); }