code: private void dfs(Node root) {
          root.setMarked(true);
          for (Edge e : root.getOutEdges()) {
              N n = e.getChild();
              if (!n.isMarked()) {
                  dfs(n);
              }
          }
      }
docs: Runs depth-first search on the graph starting at node n, marking each node as it is encountered.
  @param root