Re: [jgrapht-users] No such vertex in Graph error
Brought to you by:
barak_naveh,
perfecthash
From: Pallavi K. <kar...@gm...> - 2018-01-08 13:44:00
|
Thanks much, Will try these debugging steps.. On Jan 8, 2018 6:31 PM, "Dimitrios Michail" <dim...@gm...> wrote: > Almost always this is a problem with hashCode() and Equals() as Joris > suggested. > > Some directions for debugging: > - Make sure that your hashCode() and equals() are consistent. > - The graph creates edges using an EdgeFactory class. If you do not > provide one by the constructor, it uses a > ClassBasedEdgeFactory which calls the edge default constructor. If your > edge default constructor does not create unique objects > then you might experience such problems. > - The wiki article https://github.com/jgrapht/ > jgrapht/wiki/EqualsAndHashCode explains the most common problems, and > also describes how to use the class ParanoidGraph for debugging. > - Try to replace your vertices and edges with Graph<Integer, DefaultEdge> > and see if it works. There are plenty of examples in > the test cases of the library. > > > On Mon, Jan 8, 2018 at 12:35 PM, Pallavi Karanth <kar...@gm... > > wrote: > >> Changed vertex type to a class which implements equals and hashcode, >> Still getting the same error, >> May I know how to resolve this? >> Thanks much.. >> >> On Mon, Jan 8, 2018 at 2:21 PM, J Kinable <j.k...@gm...> wrote: >> >>> Most likely, this is the issue: >>> https://github.com/jgrapht/jgrapht/wiki/EqualsAndHashCode >>> >>> >>> On Mon, Jan 8, 2018 at 1:21 AM, Pallavi Karanth < >>> kar...@gm...> wrote: >>> >>>> Hi, >>>> >>>> Have formed a DefaultDirectedGraph like this: >>>> public DirectedGraph<OWLEntity, DefaultEdge> OWLGraph = new >>>> DefaultDirectedGraph<OWLEntity, DefaultEdge>(DefaultEdge.class); >>>> >>>> Have added vertices and edges, >>>> Vertex list is printed as follows: >>>> System.out.println(OWLGraph.vertexSet()); >>>> >>>> The list shows the vertex: >>>> http://www.semanticweb.org/drkm/ontologies/2017/4/untitled-o >>>> ntology-82#Disease >>>> >>>> Am constructing all directed paths from the graph as follows: >>>> AllDirectedPaths allPathsGraph = new AllDirectedPaths(toGraph.OWLGr >>>> aph); >>>> >>>> Here, OWLGraph is the default directed graph, >>>> >>>> Next, i call getAllPaths from source vertex http://www.semanticweb. >>>> org/drkm/ontologies/2017/4/untitled-ontology-82#Food to destination >>>> vertex: >>>> http://www.semanticweb.org/drkm/ontologies/2017/4/untitled-o >>>> ntology-82#Disease >>>> >>>> The stack trace shows the error as: >>>> java.lang.IllegalArgumentException: no such vertex in graph: >>>> http://www.semanticweb.org/drkm/ontologies/2017/4/unti >>>> tled-ontology-82#Disease >>>> at org.jgrapht.graph.AbstractGraph.assertVertexExist(AbstractGr >>>> aph.java:132) >>>> at org.jgrapht.graph.AbstractBaseGraph.incomingEdgesOf(Abstract >>>> BaseGraph.java:365) >>>> at org.jgrapht.alg.AllDirectedPaths.edgeMinDistancesBackwards(A >>>> llDirectedPaths.java:158) >>>> at org.jgrapht.alg.AllDirectedPaths.getAllPaths(AllDirectedPath >>>> s.java:105) >>>> at org.jgrapht.alg.AllDirectedPaths.getAllPaths(AllDirectedPath >>>> s.java:69) >>>> at com.mycompany.semanticdistance.SemanticDistance.SemanticDist >>>> ance(SemanticDistance.java:161) >>>> at com.mycompany.semanticdistance.SemanticDistance.loadOntology >>>> (SemanticDistance.java:136) >>>> at com.mycompany.semanticdistance.SemanticDistance.main(Semanti >>>> cDistance.java:84) >>>> >>>> May i know how to resolve this? >>>> Kindly help. >>>> Thanks much in advance >>>> >>>> -- >>>> Regs, Pallavi >>>> >>>> Linkedin Profile : http://in.linkedin.com/pub/pallavi-karanth/b/b71/26b >>>> >>>> “Your time is limited, don’t waste it living someone else’s life. Don’t >>>> be trapped by dogma, which is living the result of other people’s thinking. >>>> Don’t let the noise of other opinions drown your own inner voice. And most >>>> important, have the courage to follow your heart and intuition, they >>>> somehow already know what you truly want to become. Everything else is >>>> secondary.” >>>> >>>> -- Steve Jobs >>>> >>>> ------------------------------------------------------------ >>>> ------------------ >>>> Check out the vibrant tech community on one of the world's most >>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >>>> _______________________________________________ >>>> jgrapht-users mailing list >>>> jgr...@li... >>>> https://lists.sourceforge.net/lists/listinfo/jgrapht-users >>>> >>>> >>> >> >> >> -- >> Regs, Pallavi >> >> Linkedin Profile : http://in.linkedin.com/pub/pallavi-karanth/b/b71/26b >> >> “Your time is limited, don’t waste it living someone else’s life. Don’t >> be trapped by dogma, which is living the result of other people’s thinking. >> Don’t let the noise of other opinions drown your own inner voice. And most >> important, have the courage to follow your heart and intuition, they >> somehow already know what you truly want to become. Everything else is >> secondary.” >> >> -- Steve Jobs >> >> ------------------------------------------------------------ >> ------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >> _______________________________________________ >> jgrapht-users mailing list >> jgr...@li... >> https://lists.sourceforge.net/lists/listinfo/jgrapht-users >> >> > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > jgrapht-users mailing list > jgr...@li... > https://lists.sourceforge.net/lists/listinfo/jgrapht-users > > |