private void backwardRecursive(final Vertex currentNode, final HashSet<Vertex> visited) {
        if (visited.contains(currentNode)) {
            return;
        }

        visited.add(currentNode);

        ArrayList<Edge> es = currentNode.getAllInputEdges();
        if (es == null) {
            return;
        }

        for (Edge edge : es) {
            backwardRecursive(edge.getSrcVertex(), visited);
        }
    }