add method

void add(
  1. Node node,
  2. Queue nodeStack
)

Adds the argument node and all its out edges to the subgraph @param node the node to add @param nodeStack the current set of nodes being traversed

Implementation

void add(Node node, Queue nodeStack) {
  node.setVisited(true);
  nodes.add(node);
  for (Iterator i = (node.getEdges() as DirectedEdgeStar).iterator();
      i.moveNext();) {
    DirectedEdge de = i.current;
    dirEdgeList.add(de);
    DirectedEdge sym = de.getSym();
    Node symNode = sym.getNode()!;
    /**
     * NOTE: this is a depth-first traversal of the graph.
     * This will cause a large depth of recursion.
     * It might be better to do a breadth-first traversal.
     */
    if (!symNode.isVisited()) nodeStack.addLast(symNode);
  }
}