[jgrapht-users] graph object instantiation.
Brought to you by:
barak_naveh,
perfecthash
From: Balaji I. <bri...@gm...> - 2005-03-08 13:19:40
|
Hello, I have a DefaultDirectedGraph object as a private member of a class, which i instantiate in the constructor of the class. I then use call the addVertex function later from other files in my code structure. This is how my class looks like: class SampleGraph { private DefaultDirectedGraph g_graph; // other members // constructor SampleGraph(){ DefaultDirectedGraph g_graph = new DefaultDirectedGraph(); } // wrapper method protected final boolean addNode(Object gnode){ return g_graph.addVertex(gnode); } } elsewhere in the code i do: SampleGraph tmp-graph-obj = new SampleGraph (); tmp-obj.addVertex(tmp-node); which should add the tmp-node to the g_graph member of tmp-graph-obj, is this the right way of doing this. I get a null pointer exception here and i cant figure what i am doing wrong here. Any help would be very much appreciated. thanks |