/** * 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); } } }
nodeLowLink[start] = index; index++; nodeStack.addLast(start); onStack.add(start);
/** * Inserts all elements from the given iterable to the end of this deque. * * @param iterable The iterable to iterate over. * * @return Returns the number of elements actually added as a result of this * call. */ public int addLast(Iterable<? extends IntCursor> iterable) { int size = 0; for (IntCursor cursor : iterable) { addLast(cursor.value); size++; } return size; }
/** * Creates a new deque from elements of another container, appending elements at * the end of the deque in the iteration order. */ public IntArrayDeque(IntContainer container) { this(container.size()); addLast(container); }
/** * 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; } }
/** * Vararg-signature method for adding elements at the end of this deque. * * <p> * <b>This method is handy, but costly if used in tight loops (anonymous array * passing)</b> * </p> * * @param elements The elements to iterate over. */ /* */ public final void addLast(int... elements) { ensureBufferSpace(1); for (int k : elements) { addLast(k); } }
/** * Inserts all elements from the given container to the end of this deque. * * @param container The container to iterate over. * * @return Returns the number of elements actually added as a result of this * call. */ public int addLast(IntContainer container) { int size = container.size(); ensureBufferSpace(size); for (IntCursor cursor : container) { addLast(cursor.value); } return size; }
/** * Inserts all elements from the given iterable to the end of this deque. * * @param iterable The iterable to iterate over. * * @return Returns the number of elements actually added as a result of this * call. */ public int addLast(Iterable<? extends IntCursor> iterable) { int size = 0; for (IntCursor cursor : iterable) { addLast(cursor.value); size++; } return size; }
/** * Creates a new deque from elements of another container, appending elements at * the end of the deque in the iteration order. */ public IntArrayDeque(IntContainer container) { this(container.size()); addLast(container); }
/** * 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; } }
/** * Vararg-signature method for adding elements at the end of this deque. * * <p> * <b>This method is handy, but costly if used in tight loops (anonymous array * passing)</b> * </p> * * @param elements The elements to iterate over. */ /* */ public final void addLast(int... elements) { ensureBufferSpace(1); for (int k : elements) { addLast(k); } }
/** * Inserts all elements from the given container to the end of this deque. * * @param container The container to iterate over. * * @return Returns the number of elements actually added as a result of this * call. */ public int addLast(IntContainer container) { int size = container.size(); ensureBufferSpace(size); for (IntCursor cursor : container) { addLast(cursor.value); } return size; }
/** * 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); } } }
/** * 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); } } }
sigma[startNode] = 1; distance[startNode] = 0; queue.addLast(startNode); while (!queue.isEmpty() && running()) { int node = queue.removeFirst(); graph.forEachRelationship(node, direction, (source, target, relationId) -> { if (distance[target] < 0) { queue.addLast(target); distance[target] = distance[node] + 1;
sigma[startNode] = 1; distance[startNode] = 0; queue.addLast(startNode); while (!queue.isEmpty() && running()) { int node = queue.removeFirst(); graph.forEachRelationship(node, direction, (source, target, relationId) -> { if (distance[target] < 0) { queue.addLast(target); distance[target] = distance[node] + 1;
sigma[startNodeId] = 1; distance[startNodeId] = 0; queue.addLast(startNodeId); while (!queue.isEmpty()) { int node = queue.removeFirst(); graph.forEachRelationship(node, direction, (source, target, relationId) -> { if (distance[target] < 0) { queue.addLast(target); distance[target] = distance[node] + 1;
sigma[startNodeId] = 1; distance[startNodeId] = 0; queue.addLast(startNodeId); while (!queue.isEmpty()) { int node = queue.removeFirst(); graph.forEachRelationship(node, direction, (source, target, relationId) -> { if (distance[target] < 0) { queue.addLast(target); distance[target] = distance[node] + 1;
private void iterateBFS(int startNode, RelationshipConsumer consumer) { IntArrayDeque queue = new IntArrayDeque(); BitSet seen = new BitSet(capacity); queue.addFirst(startNode); while (!queue.isEmpty()) { int node = queue.removeFirst(); int child = children[node]; if (child != INVALID_NODE) { do { if (!seen.getAndSet(child)) { queue.addLast(child); } if (!consumer.accept( node, child, RELATION_ID_NOT_SUPPORTED)) { return; } } while ((child = siblings[child]) != INVALID_NODE); } } }
private void iterateBFS(int startNode, RelationshipConsumer consumer) { IntArrayDeque queue = new IntArrayDeque(); BitSet seen = new BitSet(capacity); queue.addFirst(startNode); while (!queue.isEmpty()) { int node = queue.removeFirst(); int child = children[node]; if (child != INVALID_NODE) { do { if (!seen.getAndSet(child)) { queue.addLast(child); } if (!consumer.accept( node, child, RELATION_ID_NOT_SUPPORTED)) { return; } } while ((child = siblings[child]) != INVALID_NODE); } } }