From: Joshua O'M. <jm...@ic...> - 2003-10-22 07:48:02
|
On Tuesday, Oct 21, 2003, at 08:19 US/Pacific, cpb...@em... wrote: > I am stumped (not SO surprising as I have been learning Java only for > the past several months). I cannot figure out WHY I keep getting the > exception in the following code: > > THE PROBLEM IS HERE--> Edge up = GraphUtils.addEdge(g, > id.getVertex(i), id.getVertex(upI)); > Edge dn = GraphUtils.addEdge(g, id.getVertex(i), > id.getVertex(downI)); > > The methods upIndex & downIndex return integers, the indexer selectes > the correct vertices using those integers and GraphUtils.addEdge > requires the arguments (graph, Archetypevertex, Archetypevertex) and > returns an AbstractSparseEdge. I have tried to initialize up and down > as AbstractSparseEdge and no luck. What am I doing wrong?? GraphUtils.addVertices(g, nodes) adds directed vertices to the graph, but g is undirected. This should cause addVertices to throw an exception, but the current release of the code does not check for this incompatibility. Instead, it appears that the incompatibility is encountered inside the call to GraphUtils.addEdge(), which is admittedly very confusing. Use GraphUtils.addUndirectedVertices(g, nodes) instead. This should fix your problem. If not, please let us know and we'll help you figure it out. For future reference, having the stack trace (the text that is printed when the exception is thrown) would be very helpful in tracking down errors like this. We appreciate your interest in JUNG. Regards, Joshua O'Madadhain jm...@ic......Obscurium Per Obscurius...www.ics.uci.edu/~jmadden Joshua O'Madadhain: Information Scientist, Musician, Philosopher-At-Tall It's that moment of dawning comprehension that I live for--Bill Watterson My opinions are too rational and insightful to be those of any organization. |