[jgrapht-users] a problem with visualization of graph
Brought to you by:
barak_naveh,
perfecthash
From: Amirali S. <ami...@gm...> - 2008-06-17 16:18:01
|
Hello everyone, I am using JgraphT for a project. I encountered to a bug which I couldn't solve it yet, so any help is greatly appreciated :). I have a randomly created graph consisting of almost 100 nodes and 2000 edges. Concisely, my code is adding/eliminating some edges during the execution. I am using JGraphModelAdaptor.class to visualize the graph by Jgraph. Interestingly, I get the following exception during the execution of code: Exception in thread "main" java.lang.NullPointerException at org.jgraph.graph.EdgeRenderer.createShape(Unknown Source) at org.jgraph.graph.EdgeView.getShape(Unknown Source) at org.jgraph.graph.EdgeRenderer.getPaintBounds(Unknown Source) at org.jgraph.graph.EdgeRenderer.getBounds(Unknown Source) at org.jgraph.graph.EdgeView.getBounds(Unknown Source) at org.jgraph.JGraph.getCellBounds(Unknown Source) at org.jgraph.JGraph.getCellBounds(Unknown Source) at org.jgraph.plaf.basic.BasicGraphUI$GraphSelectionHandler.valueChanged(Unknown Source) at org.jgraph.graph.DefaultGraphSelectionModel.fireValueChanged(Unknown Source) at org.jgraph.graph.DefaultGraphSelectionModel.notifyCellChange(Unknown Source) at org.jgraph.graph.DefaultGraphSelectionModel.setSelectionCells(Unknown Source) at org.jgraph.JGraph.setSelectionCells(Unknown Source) at org.jgraph.plaf.basic.BasicGraphUI$GraphModelHandler.graphChanged(Unknown Source) at org.jgraph.graph.DefaultGraphModel.fireGraphChanged(Unknown Source) at org.jgraph.graph.DefaultGraphModel$GraphModelEdit.execute(Unknown Source) at org.jgraph.graph.DefaultGraphModel.insert(Unknown Source) at org.jgrapht.ext.JGraphModelAdapter.internalInsertCell(JGraphModelAdapter.java:819) at org.jgrapht.ext.JGraphModelAdapter.handleJGraphTAddedEdge(JGraphModelAdapter.java:681) at org.jgrapht.ext.JGraphModelAdapter$JGraphTListener.edgeAdded(JGraphModelAdapter.java:1086) at org.jgrapht.graph.DefaultListenableGraph.fireEdgeAdded(DefaultListenableGraph.java:317) at org.jgrapht.graph.DefaultListenableGraph.addEdge(DefaultListenableGraph.java:168) at simulator.Network.connect(Network.java:39) at simulator.Simulator.processMessages(Simulator.java:257) at simulator.Simulator.messagesWorker(Simulator.java:178) at simulator.Simulator.run(Simulator.java:311) at java.lang.Thread.run(Unknown Source) at simulator.Simulator.main(Simulator.java:339) Some interesting issues according to this bug are: 1 - I don't have this bug in creation of graph - to my understanding, the edges in jgrapht are added to jgraph with *handleJGraphTAddedEdge* method. This method has been used in creation of graph(in constructor of JGraphModelAdaptor), and when the new edge is added to jgrapht (in * edgeAdded* method). Surprisingly, I am getting this bug just when the graph is changing during the execution of code, not in creation of graph. 2 - If I change the parameters of graph(number of nodes and edges) which results in less numbers of deletions and additions of edges during the execution of code, I will not get this bug... I would greatly appreciate it if anyone help me in this regard, All the best, Amirali |