When I run it, this code gives me the following error:
java.lang.IllegalArgumentException: Pair cannot contain null values
at edu.uci.ics.jung.graph.util.Pair.<init>(Pair.java:42)
at edu.uci.ics.jung.graph.AbstractGraph.addEdge(AbstractGraph.java:60)
at edu.uci.ics.jung.visualization.subLayout.GraphCollapser.expand(GraphCollapser.java:121)
at AppArbol2.actualizarGrafo(AppArbol2.java:406)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.JSInvoke.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
at sun.plugin2.liveconnect.JavaClass$MethodInfo.invoke(Unknown Source)
at sun.plugin2.liveconnect.JavaClass$MemberBundle.invoke(Unknown Source)
at sun.plugin2.liveconnect.JavaClass.invoke0(Unknown Source)
at sun.plugin2.liveconnect.JavaClass.invoke(Unknown Source)
at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$DefaultInvocationDelegate.invoke(Unknown Source)
at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo.doObjectOp(Unknown Source)
at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$LiveConnectWorker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I do not understand why the graph contains null values if I am taking it with layout.getGraph().getVertices().
If someone can tell me what I'm doing wrong, i´ll be very grateful.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I got the same problem when I tried to expand vertex of a graph.
The thing is that you have to intantiate your collapser only once with your entire expanded graph.
Indeed, you get this exception when you didn't instantiate your collapser correctly and so when it tries to expand a vertex it can't find the all the vertex needed for the edge (in this case the edge which have only one endpoint belonging to the collapsed graph).
Hope it mights help somebody.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I want to collapse or expand a vertex of a graph but not using mouse events.
I tryed to do this with this code:
GraphElementAccessor pickSupport = vv.getPickSupport();
Layout layout = vv.getGraphLayout();
Graph graph = layout.getGraph();
GraphCollapser collapser = new GraphCollapser(graph);
Collection graphVertex = new HashSet(graph.getVertices());
for (Object v: graphVertex){
if (v instanceof Graph){
Point2D ip = (Point2D)layout.transform(v);
Graph vertex = (Graph)pickSupport.getVertex(layout, ip.getX(), ip.getY());
try{
Graph g = collapser.expand(layout.getGraph(), (Graph)vertex);
vv.getRenderContext().getParallelEdgeIndexFunction().reset();
layout.setGraph(g);
vv.repaint();
}catch(Exception e){
e.printStackTrace();
}
}
}
When I run it, this code gives me the following error:
java.lang.IllegalArgumentException: Pair cannot contain null values
at edu.uci.ics.jung.graph.util.Pair.<init>(Pair.java:42)
at edu.uci.ics.jung.graph.AbstractGraph.addEdge(AbstractGraph.java:60)
at edu.uci.ics.jung.visualization.subLayout.GraphCollapser.expand(GraphCollapser.java:121)
at AppArbol2.actualizarGrafo(AppArbol2.java:406)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.JSInvoke.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
at sun.plugin2.liveconnect.JavaClass$MethodInfo.invoke(Unknown Source)
at sun.plugin2.liveconnect.JavaClass$MemberBundle.invoke(Unknown Source)
at sun.plugin2.liveconnect.JavaClass.invoke0(Unknown Source)
at sun.plugin2.liveconnect.JavaClass.invoke(Unknown Source)
at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$DefaultInvocationDelegate.invoke(Unknown Source)
at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo.doObjectOp(Unknown Source)
at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$LiveConnectWorker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I do not understand why the graph contains null values if I am taking it with layout.getGraph().getVertices().
If someone can tell me what I'm doing wrong, i´ll be very grateful.
I'm also very interested in the answer to this question.
Thanks,
Jim
I got the same problem when I tried to expand vertex of a graph.
The thing is that you have to intantiate your collapser only once with your entire expanded graph.
Indeed, you get this exception when you didn't instantiate your collapser correctly and so when it tries to expand a vertex it can't find the all the vertex needed for the edge (in this case the edge which have only one endpoint belonging to the collapsed graph).
Hope it mights help somebody.