[jgrapht-users] how to traverse a SimpleDirected Graph
Brought to you by:
barak_naveh,
perfecthash
From: Seema S. <see...@gm...> - 2012-04-13 09:33:36
|
Hi All, How can print i simple directed graph, which is composed of objects of the class "IfActivity"? Do i have to use some GraphIterator? What if i store objects of different classes in the Graph. Would be great if someone can explain on the below example. ..................................................................................... DirectedGraph<IfActivity, DefaultEdge> g = new SimpleDirectedGraph<IfActivity, DefaultEdge>(DefaultEdge. class); IfActivity vIf = new IfActivity("a","1"); IfActivity vIf2 = new IfActivity("b","1"); g.addVertex(vIf); g.addVertex(vIf2); g.addEdge(vIf, vIf2); ------------- public class IfActivity { private String ifName; private String ifCond; public IfActivity(String name, String cond){ ifName = name; ifCond = cond; } } Thanks, sana |