Home
News
Feed
search engine
by
freefind
advanced
check whether a path exists between two nodes in jgrapht 06-16-2015d1105
2015-06-16
check whether a path exists between two nodes in jgrapht 06-16-2015d1105 link -http://jgrapht.org/javadoc/org/jgrapht/alg/ConnectivityInspector.html example code { String network = useful_tools.storeTextFiletoString("C:\\Users\\Kurt\\Downloads\\read highland tribe alliance edgelist.txt"); UndirectedGraph<String, DefaultEdge> graph = gm.createStringGraph(network); ConnectivityInspector ce = new ConnectivityInspector(graph); Object[] vertices = graph.vertexSet().toArray(); useful_tools.createTextFile("C:\\Users\\Kurt\\Desktop\\temp", "all_vertices.txt", Arrays.toString(vertices)); String existence = String.valueOf(ce.pathExists(vertices[1], vertices[8])).toString(); System.out.println("State of path from " + vertices[1]+" to "+ vertices[8]+": " + existence); useful_tools.createTextFile("C:\\Users\\Kurt\\Desktop\\temp", "temp.txt", graph.toString()); }
azim58wiki: