private void addReachable(Node startNode){
  Stack nodeStack=new Stack();
  nodeStack.add(startNode);
  while (!nodeStack.empty()) {
    Node node=(Node)nodeStack.pop();
    add(node,nodeStack);
  }
}

private void addReachable ( Node startNode ) { Stack nodeStack = new Stack ( ) ; nodeStack . add ( startNode ) ; while ( ! nodeStack . empty ( ) ) { Node node = ( Node ) nodeStack . pop ( ) ; add ( node , nodeStack ) ; } }
adds all nodes and edges reachable from this node to the subgraph . uses an explicit stack to avoid a large depth of recursion .
