I am experimenting with JGraphT and have hit a brick wall trying to implement a depth first search using the JGraphT API. I have created a simple graph with nodes and vertices's as follows:
DirectedGraph <Integer, DefaultEdge> graph = new
DefaultDirectedGraph <Integer, DefaultEdge>(DefaultEdge.class);
graph.addVertex(7);
graph.addVertex(4);
graph.addVertex(9);
graph.addVertex(3);
graph.addVertex(2);
graph.addVertex(5);
graph.addEdge(7, 4);
graph.addEdge(7, 9);
graph.addEdge(9, 3);
graph.addEdge(3, 2);
graph.addEdge(3, 5);
How would I use the DepthFirstSearchIterator
to run DFS on this graph? Kind regards