//
        // DFS - Depth-First-Search
        //
        // DESCRIPTION:
        // Simple depth first traversal along out edges with node numbering.
        //
        int doDFS(BasicBlock currentNode,
                  UnionFindNode[] nodes,
                  Dictionary<BasicBlock, int> number,
                  int[] last,
                  /*final*/ int current)
        {
            nodes[current].initNode(currentNode, current);
            number.Add(currentNode, current);

            int lastid = current;
            // for (BasicBlock target : currentNode.getOutEdges()) {
            int len = currentNode.getOutEdges().size();
            for (int i = 0; i < len; i++)
            {
                BasicBlock target = currentNode.getOutEdges().get(i);
                if (number[target] == UNVISITED)
                {
                    lastid = doDFS(target, nodes, number, last, lastid + 1);
                }
            }
            last[number[currentNode]] = lastid;
            return lastid;
        }