In jgrapht, I have added some vertex.
I wanted to know how to get all vertex that I have added or already exist in jgrapht ?
Is there a way to get it ?
In jgrapht, I have added some vertex.
I wanted to know how to get all vertex that I have added or already exist in jgrapht ?
Is there a way to get it ?
This will give all the vertex in the graph.
DefaultDirectedGraph<String, DefaultEdge> directedGraph = new DefaultDirectedGraph<Node, DefaultEdge>(
DefaultEdge.class)
directedGraph.vertexSet();
You can use what Anto Livish's answer if you just have a graph If you create a GraphPath (like a shortest path), you can use getVertexList() and store them in a list