## jgrapht-users

 [jgrapht-users] getAllEdges for DirectedGraph From: Robert Manning - 2013-03-15 15:59:04 Attachments: Message as HTML Hello, I am trying to use jgrapht to answer the question : for any two vertices in a directed acyclic graph, tell me if there is a set of edges that connects the two. Based on the javadoc for getAllEdges in the Graph interface, it seemed like jgrapht could answer this question for me. However, my testing seems to prove otherwise: @Test public void testGetAllEdges() { DirectedGraph g = new DefaultDirectedGraph(DefaultEdge.class); g.addVertex("A"); g.addVertex("B"); g.addVertex("C"); g.addEdge("A", "B"); g.addEdge("B", "C"); Set edges = g.getAllEdges("A", "C"); assertFalse("There was no set of edges connecting A to C", edges.isEmpty()); } Of course, "edges" is an empty set in my test. What am I doing wrong? Rob
 Re: [jgrapht-users] getAllEdges for DirectedGraph From: Alex Moir - 2013-03-15 21:15:43 Attachments: Message as HTML It looks to me like you don't have an edge from A to C, except through B. And I think getAllEdges() only returns direct links between vertices. Maybe you are looking for a getAllPaths() type method? Alex From: Robert Manning [mailto:robert.m.manning@...] Sent: Friday, March 15, 2013 8:59 AM To: jgrapht-users@... Subject: [jgrapht-users] getAllEdges for DirectedGraph Hello, I am trying to use jgrapht to answer the question : for any two vertices in a directed acyclic graph, tell me if there is a set of edges that connects the two. Based on the javadoc for getAllEdges in the Graph interface, it seemed like jgrapht could answer this question for me. However, my testing seems to prove otherwise: @Test public void testGetAllEdges() { DirectedGraph g = new DefaultDirectedGraph(DefaultEdge.class); g.addVertex("A"); g.addVertex("B"); g.addVertex("C"); g.addEdge("A", "B"); g.addEdge("B", "C"); Set edges = g.getAllEdges("A", "C"); assertFalse("There was no set of edges connecting A to C", edges.isEmpty()); } Of course, "edges" is an empty set in my test. What am I doing wrong? Rob
 Re: [jgrapht-users] getAllEdges for DirectedGraph From: Robert Manning - 2013-03-15 21:31:55 Attachments: Message as HTML I guess if getAllEdges and getEdge do the same thing, then that's fine. By why the duplication? Why have getAllEdges when you can simply call getEdge ? Rob On Fri, Mar 15, 2013 at 4:59 PM, Alex Moir wrote: > It looks to me like you don’t have an edge from A to C, except through B. > And I think getAllEdges() only returns direct links between vertices. > Maybe you are looking for a getAllPaths() type method?**** > > ** ** > > Alex**** > > ** ** > > *From:* Robert Manning [mailto:robert.m.manning@...] > *Sent:* Friday, March 15, 2013 8:59 AM > *To:* jgrapht-users@... > *Subject:* [jgrapht-users] getAllEdges for DirectedGraph**** > > ** ** > > Hello, > > I am trying to use jgrapht to answer the question : for any two vertices > in a directed acyclic graph, tell me if there is a set of edges that > connects the two. Based on the javadoc for getAllEdges in the Graph > interface, it seemed like jgrapht could answer this question for me. > However, my testing seems to prove otherwise: > > @Test > public void testGetAllEdges() { > > DirectedGraph g = new DefaultDirectedGraph DefaultEdge>(DefaultEdge.class); > > g.addVertex("A"); > g.addVertex("B"); > g.addVertex("C"); > > g.addEdge("A", "B"); > g.addEdge("B", "C"); > > Set edges = g.getAllEdges("A", "C"); > > assertFalse("There was no set of edges connecting A to C", > edges.isEmpty()); > > } > > Of course, "edges" is an empty set in my test. What am I doing wrong? > > Rob**** >