public void bfs(DirectedNode root) {
        Queue<DirectedNode> queue = new LinkedList<DirectedNode>();
        queue.add(root);
        root.visited = true;
        while (!queue.isEmpty()) {
            DirectedNode curNode = queue.poll();
            System.out.println(curNode.data + " ");
            for (DirectedNode n : curNode.edgeNodes) {
                if (!n.visited) {
                    n.visited = true;
                    queue.add(n);
                }
            }
        }

    }