From: Robert Manning <robert.manning@gm...>  20130315 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<String, DefaultEdge> g = new DefaultDirectedGraph<String, DefaultEdge>(DefaultEdge.class); g.addVertex("A"); g.addVertex("B"); g.addVertex("C"); g.addEdge("A", "B"); g.addEdge("B", "C"); Set<DefaultEdge> 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 
From: Alex Moir <amoir@di...>  20130315 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: jgraphtusers@... Subject: [jgraphtusers] 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<String, DefaultEdge> g = new DefaultDirectedGraph<String, DefaultEdge>(DefaultEdge.class); g.addVertex("A"); g.addVertex("B"); g.addVertex("C"); g.addEdge("A", "B"); g.addEdge("B", "C"); Set<DefaultEdge> 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 
From: Robert Manning <robert.manning@gm...>  20130315 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 <amoir@...>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:* jgraphtusers@... > *Subject:* [jgraphtusers] 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<String, DefaultEdge> g = new DefaultDirectedGraph<String, > DefaultEdge>(DefaultEdge.class); > > g.addVertex("A"); > g.addVertex("B"); > g.addVertex("C"); > > g.addEdge("A", "B"); > g.addEdge("B", "C"); > > Set<DefaultEdge> 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**** > 
From: John Sichi <jsichi@gm...>  20130315 21:40:22

For multigraphs, getAllEdges is necessary to be able to iterate over multiple edges between the same vertex pair. For simple graphs, that would be inconvenient. JVS On Fri, Mar 15, 2013 at 2:31 PM, Robert Manning <robert.m.manning@...> wrote: > 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 <amoir@...> > 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: jgraphtusers@... >> Subject: [jgraphtusers] 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<String, DefaultEdge> g = new DefaultDirectedGraph<String, >> DefaultEdge>(DefaultEdge.class); >> >> g.addVertex("A"); >> g.addVertex("B"); >> g.addVertex("C"); >> >> g.addEdge("A", "B"); >> g.addEdge("B", "C"); >> >> Set<DefaultEdge> 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 > > > >  > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_mar > _______________________________________________ > jgraphtusers mailing list > jgraphtusers@... > https://lists.sourceforge.net/lists/listinfo/jgraphtusers > 
From: Tobias Dehling <dehling@wi...>  20130315 22:36:45
Attachments:
Message as HTML

There could be multiple edge between two vertices. getEdge will get you one of them and getAllEdges will return all of them. Tobias On 03/15/2013 10:31 PM, Robert Manning wrote: > 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 > <amoir@... <mailto:amoir@...>> > 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@... > <mailto:robert.m.manning@...>] > *Sent:* Friday, March 15, 2013 8:59 AM > *To:* jgraphtusers@... > <mailto:jgraphtusers@...> > *Subject:* [jgraphtusers] 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<String, DefaultEdge> g = new > DefaultDirectedGraph<String, DefaultEdge>(DefaultEdge.class); > > g.addVertex("A"); > g.addVertex("B"); > g.addVertex("C"); > > g.addEdge("A", "B"); > g.addEdge("B", "C"); > > Set<DefaultEdge> 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 > > > > >  > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_mar > > > _______________________________________________ > jgraphtusers mailing list > jgraphtusers@... > https://lists.sourceforge.net/lists/listinfo/jgraphtusers  Dipl.Wirt.Inf. Tobias Dehling Universität zu Köln Seminar für Wirtschaftsinformatik und Systementwicklung Juniorprofessur für Information Systems Quality Juniorprofessor Dr. Ali Sunyaev Wirtschafts und Sozialwissenschaftliche Fakultät Pohligstr. 1, 50969 Köln Tel: +49 221 4705383 (Durchwahl) +49 221 4705368 (Sekretariat) Fax: +49 221 4705386 Mail: dehling@... Web: http://www.isq.unikoeln.de 
From: Robert Manning <robert.manning@gm...>  20130316 00:32:50
Attachments:
Message as HTML

Somehow, in a DAG that makes no sense to me ? Rob On Fri, Mar 15, 2013 at 5:35 PM, Tobias Dehling <dehling@...>wrote: > There could be multiple edge between two vertices. getEdge will get you > one of them and getAllEdges will return all of them. > > Tobias > > > On 03/15/2013 10:31 PM, Robert Manning wrote: > > 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 <amoir@...>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:* jgraphtusers@... >> *Subject:* [jgraphtusers] 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<String, DefaultEdge> g = new DefaultDirectedGraph<String, >> DefaultEdge>(DefaultEdge.class); >> >> g.addVertex("A"); >> g.addVertex("B"); >> g.addVertex("C"); >> >> g.addEdge("A", "B"); >> g.addEdge("B", "C"); >> >> Set<DefaultEdge> 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 >> > > > >  > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today:http://p.sf.net/sfu/appdyn_d2d_mar > > > > _______________________________________________ > jgraphtusers mailing listjgraphtusers@...nethttps://lists.sourceforge.net/lists/listinfo/jgraphtusers > > > >  > Dipl.Wirt.Inf. Tobias Dehling > > Universität zu Köln > Seminar für Wirtschaftsinformatik und Systementwicklung > Juniorprofessur für Information Systems Quality > Juniorprofessor Dr. Ali Sunyaev > Wirtschafts und Sozialwissenschaftliche Fakultät > > Pohligstr. 1, 50969 Köln > > Tel: +49 221 4705383 (Durchwahl) > +49 221 4705368 (Sekretariat) > Fax: +49 221 4705386 > Mail: dehling@... > Web: http://www.isq.unikoeln.de > > > >  > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_mar > _______________________________________________ > jgraphtusers mailing list > jgraphtusers@... > https://lists.sourceforge.net/lists/listinfo/jgraphtusers > > 
From: John Sichi <jsichi@gm...>  20130316 00:39:28
Attachments:
Message as HTML

JGraphT is not just for DAG's. On Mar 15, 2013 5:33 PM, "Robert Manning" <robert.m.manning@...> wrote: > Somehow, in a DAG that makes no sense to me ? > > Rob > > On Fri, Mar 15, 2013 at 5:35 PM, Tobias Dehling <dehling@... > > wrote: > >> There could be multiple edge between two vertices. getEdge will get you >> one of them and getAllEdges will return all of them. >> >> Tobias >> >> >> On 03/15/2013 10:31 PM, Robert Manning wrote: >> >> 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 <amoir@... >> > 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:* jgraphtusers@... >>> *Subject:* [jgraphtusers] 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<String, DefaultEdge> g = new >>> DefaultDirectedGraph<String, DefaultEdge>(DefaultEdge.class); >>> >>> g.addVertex("A"); >>> g.addVertex("B"); >>> g.addVertex("C"); >>> >>> g.addEdge("A", "B"); >>> g.addEdge("B", "C"); >>> >>> Set<DefaultEdge> 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 >>> >> >> >> >>  >> Everyone hates slow websites. So do we. >> Make your web apps faster with AppDynamics >> Download AppDynamics Lite for free today:http://p.sf.net/sfu/appdyn_d2d_mar >> >> >> >> _______________________________________________ >> jgraphtusers mailing listjgraphtusers@...nethttps://lists.sourceforge.net/lists/listinfo/jgraphtusers >> >> >> >>  >> Dipl.Wirt.Inf. Tobias Dehling >> >> Universität zu Köln >> Seminar für Wirtschaftsinformatik und Systementwicklung >> Juniorprofessur für Information Systems Quality >> Juniorprofessor Dr. Ali Sunyaev >> Wirtschafts und Sozialwissenschaftliche Fakultät >> >> Pohligstr. 1, 50969 Köln >> >> Tel: +49 221 4705383 (Durchwahl) >> +49 221 4705368 (Sekretariat) >> Fax: +49 221 4705386 >> Mail: dehling@... >> Web: http://www.isq.unikoeln.de >> >> >> >>  >> Everyone hates slow websites. So do we. >> Make your web apps faster with AppDynamics >> Download AppDynamics Lite for free today: >> http://p.sf.net/sfu/appdyn_d2d_mar >> _______________________________________________ >> jgraphtusers mailing list >> jgraphtusers@... >> https://lists.sourceforge.net/lists/listinfo/jgraphtusers >> >> > > >  > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_mar > _______________________________________________ > jgraphtusers mailing list > jgraphtusers@... > https://lists.sourceforge.net/lists/listinfo/jgraphtusers > > 
From: John Sichi <jsichi@gm...>  20130316 01:27:25

Anyway, to get back to your original problem...if you just want to test whether such a sequence of edges exists (without identifying them), you can use ConnectivityInspector.pathExists. Otherwise, you can use one of the traversal iterators such as DFS or BFS to find an arbitrary path, or one of the shortestpath algorithms if you care about path length. On Fri, Mar 15, 2013 at 5:39 PM, John Sichi <jsichi@...> wrote: > JGraphT is not just for DAG's. > > On Mar 15, 2013 5:33 PM, "Robert Manning" <robert.m.manning@...> > wrote: >> >> Somehow, in a DAG that makes no sense to me ? >> >> Rob >> >> On Fri, Mar 15, 2013 at 5:35 PM, Tobias Dehling >> <dehling@...> wrote: >>> >>> There could be multiple edge between two vertices. getEdge will get you >>> one of them and getAllEdges will return all of them. >>> >>> Tobias >>> >>> >>> On 03/15/2013 10:31 PM, Robert Manning wrote: >>> >>> 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 >>> <amoir@...> 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: jgraphtusers@... >>>> Subject: [jgraphtusers] 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<String, DefaultEdge> g = new >>>> DefaultDirectedGraph<String, DefaultEdge>(DefaultEdge.class); >>>> >>>> g.addVertex("A"); >>>> g.addVertex("B"); >>>> g.addVertex("C"); >>>> >>>> g.addEdge("A", "B"); >>>> g.addEdge("B", "C"); >>>> >>>> Set<DefaultEdge> 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 >>> >>> >>> >>> >>> >>>  >>> Everyone hates slow websites. So do we. >>> Make your web apps faster with AppDynamics >>> Download AppDynamics Lite for free today: >>> http://p.sf.net/sfu/appdyn_d2d_mar >>> >>> >>> >>> _______________________________________________ >>> jgraphtusers mailing list >>> jgraphtusers@... >>> https://lists.sourceforge.net/lists/listinfo/jgraphtusers >>> >>> >>> >>>  >>> Dipl.Wirt.Inf. Tobias Dehling >>> >>> Universität zu Köln >>> Seminar für Wirtschaftsinformatik und Systementwicklung >>> Juniorprofessur für Information Systems Quality >>> Juniorprofessor Dr. Ali Sunyaev >>> Wirtschafts und Sozialwissenschaftliche Fakultät >>> >>> Pohligstr. 1, 50969 Köln >>> >>> Tel: +49 221 4705383 (Durchwahl) >>> +49 221 4705368 (Sekretariat) >>> Fax: +49 221 4705386 >>> Mail: dehling@... >>> Web: http://www.isq.unikoeln.de >>> >>> >>> >>>  >>> Everyone hates slow websites. So do we. >>> Make your web apps faster with AppDynamics >>> Download AppDynamics Lite for free today: >>> http://p.sf.net/sfu/appdyn_d2d_mar >>> _______________________________________________ >>> jgraphtusers mailing list >>> jgraphtusers@... >>> https://lists.sourceforge.net/lists/listinfo/jgraphtusers >>> >> >> >> >>  >> Everyone hates slow websites. So do we. >> Make your web apps faster with AppDynamics >> Download AppDynamics Lite for free today: >> http://p.sf.net/sfu/appdyn_d2d_mar >> _______________________________________________ >> jgraphtusers mailing list >> jgraphtusers@... >> https://lists.sourceforge.net/lists/listinfo/jgraphtusers >> > 
From: Robert Manning <robert.manning@gm...>  20130318 12:35:37
Attachments:
Message as HTML

That works, sort of. Reading the javadoc it indicates that edge directions are ignored for a DirectedGraph. And in my test I can flip "A" and "C" and pathExists still returns true. I am trying to model Maven downstream project dependencies. Is there no way to have the path test respect edge directions ? Rob On Fri, Mar 15, 2013 at 9:27 PM, John Sichi <jsichi@...> wrote: > Anyway, to get back to your original problem...if you just want to > test whether such a sequence of edges exists (without identifying > them), you can use ConnectivityInspector.pathExists. Otherwise, you > can use one of the traversal iterators such as DFS or BFS to find an > arbitrary path, or one of the shortestpath algorithms if you care > about path length. > > On Fri, Mar 15, 2013 at 5:39 PM, John Sichi <jsichi@...> wrote: > > JGraphT is not just for DAG's. > > > > On Mar 15, 2013 5:33 PM, "Robert Manning" <robert.m.manning@...> > > wrote: > >> > >> Somehow, in a DAG that makes no sense to me ? > >> > >> Rob > >> > >> On Fri, Mar 15, 2013 at 5:35 PM, Tobias Dehling > >> <dehling@...> wrote: > >>> > >>> There could be multiple edge between two vertices. getEdge will get you > >>> one of them and getAllEdges will return all of them. > >>> > >>> Tobias > >>> > >>> > >>> On 03/15/2013 10:31 PM, Robert Manning wrote: > >>> > >>> 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 > >>> <amoir@...> 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: jgraphtusers@... > >>>> Subject: [jgraphtusers] 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<String, DefaultEdge> g = new > >>>> DefaultDirectedGraph<String, DefaultEdge>(DefaultEdge.class); > >>>> > >>>> g.addVertex("A"); > >>>> g.addVertex("B"); > >>>> g.addVertex("C"); > >>>> > >>>> g.addEdge("A", "B"); > >>>> g.addEdge("B", "C"); > >>>> > >>>> Set<DefaultEdge> 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 > >>> > >>> > >>> > >>> > >>> > >>> >  > >>> Everyone hates slow websites. So do we. > >>> Make your web apps faster with AppDynamics > >>> Download AppDynamics Lite for free today: > >>> http://p.sf.net/sfu/appdyn_d2d_mar > >>> > >>> > >>> > >>> _______________________________________________ > >>> jgraphtusers mailing list > >>> jgraphtusers@... > >>> https://lists.sourceforge.net/lists/listinfo/jgraphtusers > >>> > >>> > >>> > >>>  > >>> Dipl.Wirt.Inf. Tobias Dehling > >>> > >>> Universität zu Köln > >>> Seminar für Wirtschaftsinformatik und Systementwicklung > >>> Juniorprofessur für Information Systems Quality > >>> Juniorprofessor Dr. Ali Sunyaev > >>> Wirtschafts und Sozialwissenschaftliche Fakultät > >>> > >>> Pohligstr. 1, 50969 Köln > >>> > >>> Tel: +49 221 4705383 (Durchwahl) > >>> +49 221 4705368 (Sekretariat) > >>> Fax: +49 221 4705386 > >>> Mail: dehling@... > >>> Web: http://www.isq.unikoeln.de > >>> > >>> > >>> > >>> >  > >>> Everyone hates slow websites. So do we. > >>> Make your web apps faster with AppDynamics > >>> Download AppDynamics Lite for free today: > >>> http://p.sf.net/sfu/appdyn_d2d_mar > >>> _______________________________________________ > >>> jgraphtusers mailing list > >>> jgraphtusers@... > >>> https://lists.sourceforge.net/lists/listinfo/jgraphtusers > >>> > >> > >> > >> > >> >  > >> Everyone hates slow websites. So do we. > >> Make your web apps faster with AppDynamics > >> Download AppDynamics Lite for free today: > >> http://p.sf.net/sfu/appdyn_d2d_mar > >> _______________________________________________ > >> jgraphtusers mailing list > >> jgraphtusers@... > >> https://lists.sourceforge.net/lists/listinfo/jgraphtusers > >> > > > 
From: John Sichi <jsichi@gm...>  20130318 15:20:49

Oh, sorry, I forgot about that; the Javadoc is correct. For the least amount of code, you can use http://jgrapht.org/javadoc/org/jgrapht/alg/DijkstraShortestPath.html#findPathBetween(org.jgrapht.Graph, V, V) If you are going to be making lots of tests on the same graph, then use FloydWarshallShortestPaths instead. On Mon, Mar 18, 2013 at 5:35 AM, Robert Manning <robert.m.manning@...> wrote: > That works, sort of. Reading the javadoc it indicates that edge directions > are ignored for a DirectedGraph. And in my test I can flip "A" and "C" and > pathExists still returns true. I am trying to model Maven downstream > project dependencies. Is there no way to have the path test respect edge > directions ? > > Rob > > > On Fri, Mar 15, 2013 at 9:27 PM, John Sichi <jsichi@...> wrote: >> >> Anyway, to get back to your original problem...if you just want to >> test whether such a sequence of edges exists (without identifying >> them), you can use ConnectivityInspector.pathExists. Otherwise, you >> can use one of the traversal iterators such as DFS or BFS to find an >> arbitrary path, or one of the shortestpath algorithms if you care >> about path length. >> >> On Fri, Mar 15, 2013 at 5:39 PM, John Sichi <jsichi@...> wrote: >> > JGraphT is not just for DAG's. >> > >> > On Mar 15, 2013 5:33 PM, "Robert Manning" <robert.m.manning@...> >> > wrote: >> >> >> >> Somehow, in a DAG that makes no sense to me ? >> >> >> >> Rob >> >> >> >> On Fri, Mar 15, 2013 at 5:35 PM, Tobias Dehling >> >> <dehling@...> wrote: >> >>> >> >>> There could be multiple edge between two vertices. getEdge will get >> >>> you >> >>> one of them and getAllEdges will return all of them. >> >>> >> >>> Tobias >> >>> >> >>> >> >>> On 03/15/2013 10:31 PM, Robert Manning wrote: >> >>> >> >>> 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 >> >>> <amoir@...> 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: jgraphtusers@... >> >>>> Subject: [jgraphtusers] 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<String, DefaultEdge> g = new >> >>>> DefaultDirectedGraph<String, DefaultEdge>(DefaultEdge.class); >> >>>> >> >>>> g.addVertex("A"); >> >>>> g.addVertex("B"); >> >>>> g.addVertex("C"); >> >>>> >> >>>> g.addEdge("A", "B"); >> >>>> g.addEdge("B", "C"); >> >>>> >> >>>> Set<DefaultEdge> 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 >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>>  >> >>> Everyone hates slow websites. So do we. >> >>> Make your web apps faster with AppDynamics >> >>> Download AppDynamics Lite for free today: >> >>> http://p.sf.net/sfu/appdyn_d2d_mar >> >>> >> >>> >> >>> >> >>> _______________________________________________ >> >>> jgraphtusers mailing list >> >>> jgraphtusers@... >> >>> https://lists.sourceforge.net/lists/listinfo/jgraphtusers >> >>> >> >>> >> >>> >> >>>  >> >>> Dipl.Wirt.Inf. Tobias Dehling >> >>> >> >>> Universität zu Köln >> >>> Seminar für Wirtschaftsinformatik und Systementwicklung >> >>> Juniorprofessur für Information Systems Quality >> >>> Juniorprofessor Dr. Ali Sunyaev >> >>> Wirtschafts und Sozialwissenschaftliche Fakultät >> >>> >> >>> Pohligstr. 1, 50969 Köln >> >>> >> >>> Tel: +49 221 4705383 (Durchwahl) >> >>> +49 221 4705368 (Sekretariat) >> >>> Fax: +49 221 4705386 >> >>> Mail: dehling@... >> >>> Web: http://www.isq.unikoeln.de >> >>> >> >>> >> >>> >> >>> >> >>>  >> >>> Everyone hates slow websites. So do we. >> >>> Make your web apps faster with AppDynamics >> >>> Download AppDynamics Lite for free today: >> >>> http://p.sf.net/sfu/appdyn_d2d_mar >> >>> _______________________________________________ >> >>> jgraphtusers mailing list >> >>> jgraphtusers@... >> >>> https://lists.sourceforge.net/lists/listinfo/jgraphtusers >> >>> >> >> >> >> >> >> >> >> >> >>  >> >> Everyone hates slow websites. So do we. >> >> Make your web apps faster with AppDynamics >> >> Download AppDynamics Lite for free today: >> >> http://p.sf.net/sfu/appdyn_d2d_mar >> >> _______________________________________________ >> >> jgraphtusers mailing list >> >> jgraphtusers@... >> >> https://lists.sourceforge.net/lists/listinfo/jgraphtusers >> >> >> > > > 