The "instanceofpredicate" checks to see whether the edge is of the appropriate type--directed or undirected. I'd guess that your graph is undirected, and the edge that you're adding is directed.
Joshua
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I don't understand your question. What do you mean by "correct"? (Or "he" for that matter?) Be more specific: what exactly is happening that is not what you expect?
Joshua
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What i meant, was, that my matrix is an unsymmetric matrix and i got a UndirectedSparseGraph, but with correct arrows.. hm.. ok.. so far. I have got it working now somehow.
Regarding your hint for wrong GraphType there is another problem.
I only accidently posted the wrong error Message (the Instance Error).
But i need a solution for this error:
Exception in thread "AWT-EventQueue-0" edu.uci.ics.jung.exceptions.ConstraintViolationException: Predicate org.apache.commons.collections.functors.NotPredicate rejected E2(V5,V2): org.apache.commons.collections.functors.NotPredicate@18fb1f7
at edu.uci.ics.jung.graph.impl.AbstractArchetypeGraph.validate(AbstractArchetypeGraph.java:252)
The problem is, that i removed now almost all edges and i still get this notPredicate error when running this code:
My idea is to add a try catch block for a test, set a breakpoint into the catch block and then step through the exception to see what is really in there.
Why do I think this should work?
The Not predicate that produces this error has a predicate in it. The Not predicate is violated because the inner predicate is the problem. To get an idea of what is wrong we need to know what the inner predicate is.
Therefore getting the precise definition of the inner predicate should help us.
Is this ok for you?
Dirk
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Apparently your original matrix is symmetric, so MatrixFile creates an UndirectedSparseGraph. If you want a directed graph, use the DirectionTransformer class to convert the original graph. (Casting an object to something of another type doesn't change the object at all; it just changes the reference that you have to it. If the original object's type is not consistent with the type that you try to cast it to, a ClassCastException is thrown.)
Joshua
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I alreday used the Debugger before you advised it, but i couldnt understand, how this Predicate could be a problem, because there is no edge at the moment, when i add this edge.
Its also happens, when there is no edge in the Graph.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
because i can go into it and it will never end:
+ cause= ConstraintViolationException (id=47)
+ cause= ConstraintViolationException (id=47)
+ cause= ConstraintViolationException (id=47)
+ cause= ConstraintViolationException (id=47)
+ ....and so on
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
a. check and recheck that getjIndexer and getjGraph return compatible objects. I mean that the indexer you return via getjIndexer really is the indexer of the graph returned by getjGraph.
b. check (via numEdges()) that the graph is really empty before adding the edge
c. step with the debugger through addEdge. This should give you the edge that causes the defect (or an idea of what is wrong).
Dirk
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It fires now an ActionCommand for a Button randomly between 2 and 6 times... But i cant stop this. I have to reinstall all and will see then, if it still occurs...
Sorry so far.. if it works again, i will post the result.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
is there something left open? I'm not sure if you are happy or if there is something to be cleared. Please provide a pointer if there is something left.
Cheers,
Dirk
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, me again :)
I try to add an edge at runtime and i get the following error message:
Exception in thread "AWT-EventQueue-0" edu.uci.ics.jung.exceptions.ConstraintViolationException: Predicate org.apache.commons.collections.functors.InstanceofPredicate rejected E0(V5,V5): org.apache.commons.collections.functors.InstanceofPredicate@ece65
The graph is created from an importet Matrix.
I already tried it with a graph without any edges included. There are only vertices.
But if i do so:
VisualizationViewer vv = getjGraphDrawJInternalFrame().getjGraphDraw().getVisualizationViewer();
vv.suspend();
System.out.println("P: Suspending!");
Graph g = getjGraphDrawJInternalFrame().getjGraph();
Indexer index = Indexer.getIndexer(g);
Vertex v1 = (Vertex) index.getVertex(1);
g.addEdge(new DirectedSparseEdge(v1,v1));
if (!vv.isVisRunnerRunning())
vv.init();
else
vv.unsuspend();
System.out.println("P: Not Suspending!");
I get this confusing message.
Where is my problem?
:)
The "instanceofpredicate" checks to see whether the edge is of the appropriate type--directed or undirected. I'd guess that your graph is undirected, and the edge that you're adding is directed.
Joshua
Hm... may be, that this is a reason.
But if i import a Matrix, i only get a "Graph", but no "DirectedSparseGraph".
And a conversion is not Possible, as far as the library says me, when i try it.
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: edu.uci.ics.jung.graph.impl.UndirectedSparseGraph
What can i do?
A question by the way - if the graph is an UndirectedSparseGraph, why he shows the arrows correct, when i load it from a matrix.
I don't understand your question. What do you mean by "correct"? (Or "he" for that matter?) Be more specific: what exactly is happening that is not what you expect?
Joshua
What i meant, was, that my matrix is an unsymmetric matrix and i got a UndirectedSparseGraph, but with correct arrows.. hm.. ok.. so far. I have got it working now somehow.
Regarding your hint for wrong GraphType there is another problem.
I only accidently posted the wrong error Message (the Instance Error).
But i need a solution for this error:
Exception in thread "AWT-EventQueue-0" edu.uci.ics.jung.exceptions.ConstraintViolationException: Predicate org.apache.commons.collections.functors.NotPredicate rejected E2(V5,V2): org.apache.commons.collections.functors.NotPredicate@18fb1f7
at edu.uci.ics.jung.graph.impl.AbstractArchetypeGraph.validate(AbstractArchetypeGraph.java:252)
The problem is, that i removed now almost all edges and i still get this notPredicate error when running this code:
Vertex v1 = (Vertex) getjIndexer().getVertex(1);
Vertex v2 = (Vertex) getjIndexer().getVertex(3);
getjGraph().addEdge(new DirectedSparseEdge(v1,v2));
if (!getjVisualizationViewer().isVisRunnerRunning())
getjVisualizationViewer().init();
else
getjVisualizationViewer().unsuspend();
getjVisualizationViewer().repaint();
getjGraphDraw().repaint();
Which Predicate is meant? Is an ordinary DirectedSparseEdge (Undiredted causes the Instance Error)
I dont want to write a try/catch clause, because i think, this error can be obsolete.
Can you give me a hint about whats wrong?
Hello,
have you ever worked with a debugger?
My idea is to add a try catch block for a test, set a breakpoint into the catch block and then step through the exception to see what is really in there.
Why do I think this should work?
The Not predicate that produces this error has a predicate in it. The Not predicate is violated because the inner predicate is the problem. To get an idea of what is wrong we need to know what the inner predicate is.
Therefore getting the precise definition of the inner predicate should help us.
Is this ok for you?
Dirk
Apparently your original matrix is symmetric, so MatrixFile creates an UndirectedSparseGraph. If you want a directed graph, use the DirectionTransformer class to convert the original graph. (Casting an object to something of another type doesn't change the object at all; it just changes the reference that you have to it. If the original object's type is not consistent with the type that you try to cast it to, a ClassCastException is thrown.)
Joshua
i forgot to write - if i import the Matrix, i only get an UndirectedSparseGraph
Yes, i am able ;)
Its the ParallelEdgePredicate.
I alreday used the Debugger before you advised it, but i couldnt understand, how this Predicate could be a problem, because there is no edge at the moment, when i add this edge.
Its also happens, when there is no edge in the Graph.
There is also a cause field.
This seems to be a loop
cause= ConstraintViolationException (id=47)
because i can go into it and it will never end:
+ cause= ConstraintViolationException (id=47)
+ cause= ConstraintViolationException (id=47)
+ cause= ConstraintViolationException (id=47)
+ cause= ConstraintViolationException (id=47)
+ ....and so on
Hi,
to be honest: I have no idea what is wrong. :-(
Some suggestions:
a. check and recheck that getjIndexer and getjGraph return compatible objects. I mean that the indexer you return via getjIndexer really is the indexer of the graph returned by getjGraph.
b. check (via numEdges()) that the graph is really empty before adding the edge
c. step with the debugger through addEdge. This should give you the edge that causes the defect (or an idea of what is wrong).
Dirk
Oh, may be, that i found a reason...
A stupid and he has nothing to do with jung :/
Something is wrong with my Java installation.
It fires now an ActionCommand for a Button randomly between 2 and 6 times... But i cant stop this. I have to reinstall all and will see then, if it still occurs...
Sorry so far.. if it works again, i will post the result.
reinstalling Java helped :/
Sorry for the second question :)
Hi,
is there something left open? I'm not sure if you are happy or if there is something to be cleared. Please provide a pointer if there is something left.
Cheers,
Dirk