jgrapht-users Mailing List for JGraphT (Page 6)
Brought to you by:
barak_naveh,
perfecthash
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(2) |
2005 |
Jan
|
Feb
(1) |
Mar
(5) |
Apr
(1) |
May
|
Jun
(12) |
Jul
(6) |
Aug
(7) |
Sep
(2) |
Oct
|
Nov
(1) |
Dec
|
2006 |
Jan
(4) |
Feb
(3) |
Mar
(2) |
Apr
(3) |
May
(6) |
Jun
(2) |
Jul
(3) |
Aug
(12) |
Sep
(6) |
Oct
(3) |
Nov
(12) |
Dec
|
2007 |
Jan
(6) |
Feb
|
Mar
(6) |
Apr
(8) |
May
(2) |
Jun
(8) |
Jul
(2) |
Aug
(3) |
Sep
(7) |
Oct
(3) |
Nov
|
Dec
(1) |
2008 |
Jan
(11) |
Feb
(4) |
Mar
(8) |
Apr
(3) |
May
(4) |
Jun
(1) |
Jul
|
Aug
(3) |
Sep
(1) |
Oct
(4) |
Nov
(5) |
Dec
(5) |
2009 |
Jan
(3) |
Feb
(12) |
Mar
(14) |
Apr
(9) |
May
(8) |
Jun
(1) |
Jul
(4) |
Aug
(10) |
Sep
|
Oct
(10) |
Nov
|
Dec
(4) |
2010 |
Jan
(9) |
Feb
(16) |
Mar
(14) |
Apr
(19) |
May
(1) |
Jun
(3) |
Jul
(17) |
Aug
(9) |
Sep
(4) |
Oct
(4) |
Nov
(11) |
Dec
(8) |
2011 |
Jan
(10) |
Feb
(11) |
Mar
(10) |
Apr
(14) |
May
(6) |
Jun
(8) |
Jul
(9) |
Aug
(11) |
Sep
(13) |
Oct
(7) |
Nov
(9) |
Dec
(1) |
2012 |
Jan
(5) |
Feb
(14) |
Mar
(4) |
Apr
(25) |
May
(18) |
Jun
(18) |
Jul
(3) |
Aug
(6) |
Sep
(3) |
Oct
(16) |
Nov
(5) |
Dec
(12) |
2013 |
Jan
(1) |
Feb
(6) |
Mar
(14) |
Apr
(34) |
May
(9) |
Jun
(3) |
Jul
(8) |
Aug
|
Sep
(10) |
Oct
(11) |
Nov
(11) |
Dec
(15) |
2014 |
Jan
(2) |
Feb
(6) |
Mar
(11) |
Apr
(12) |
May
(6) |
Jun
(7) |
Jul
|
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
(5) |
Dec
(6) |
2015 |
Jan
(15) |
Feb
(4) |
Mar
(7) |
Apr
(8) |
May
(1) |
Jun
(18) |
Jul
(27) |
Aug
(13) |
Sep
(4) |
Oct
(8) |
Nov
(7) |
Dec
(6) |
2016 |
Jan
(4) |
Feb
(5) |
Mar
|
Apr
(15) |
May
(5) |
Jun
(4) |
Jul
(1) |
Aug
(1) |
Sep
(7) |
Oct
(2) |
Nov
(4) |
Dec
(2) |
2017 |
Jan
(7) |
Feb
(1) |
Mar
(17) |
Apr
(2) |
May
(1) |
Jun
|
Jul
|
Aug
(3) |
Sep
(3) |
Oct
|
Nov
(5) |
Dec
(6) |
2018 |
Jan
(23) |
Feb
(17) |
Mar
(4) |
Apr
(5) |
May
(6) |
Jun
(3) |
Jul
(5) |
Aug
(2) |
Sep
(3) |
Oct
(2) |
Nov
(5) |
Dec
|
2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
(2) |
Mar
|
Apr
(1) |
May
(1) |
Jun
(8) |
Jul
(8) |
Aug
|
Sep
(2) |
Oct
(9) |
Nov
|
Dec
(1) |
2021 |
Jan
|
Feb
(4) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
(3) |
Oct
(3) |
Nov
(1) |
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(4) |
Nov
|
Dec
|
2024 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Pallavi K. <kar...@gm...> - 2018-01-08 06:21:29
|
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-ontology-82#Disease Am constructing all directed paths from the graph as follows: AllDirectedPaths allPathsGraph = new AllDirectedPaths(toGraph.OWLGraph); 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-ontology-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/ untitled-ontology-82#Disease at org.jgrapht.graph.AbstractGraph.assertVertexExist(AbstractGraph.java:132) at org.jgrapht.graph.AbstractBaseGraph.incomingEdgesOf( AbstractBaseGraph.java:365) at org.jgrapht.alg.AllDirectedPaths.edgeMinDistancesBackwards( AllDirectedPaths.java:158) at org.jgrapht.alg.AllDirectedPaths.getAllPaths(AllDirectedPaths.java:105) at org.jgrapht.alg.AllDirectedPaths.getAllPaths(AllDirectedPaths.java:69) at com.mycompany.semanticdistance.SemanticDistance.SemanticDistance( SemanticDistance.java:161) at com.mycompany.semanticdistance.SemanticDistance.loadOntology( SemanticDistance.java:136) at com.mycompany.semanticdistance.SemanticDistance.main( SemanticDistance.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 |
From: John S. <js...@gm...> - 2018-01-07 01:21:42
|
Applications should use getEdgeSource and getEdgeTarget from the graph interface rather than accessing these directly. So they are protected in order to prevent accidental use. On Jan 6, 2018 5:04 PM, "Victor Porton" <po...@na...> wrote: > Why in > http://jgrapht.org/javadoc/org/jgrapht/graph/DefaultEdge.html > getSource() and getTarget() are protected (rather than public)? > > I don't see any sense of them being non-public. > > ------------------------------------------------------------ > ------------------ > 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 > > |
From: Victor P. <po...@na...> - 2018-01-07 01:03:57
|
Why in http://jgrapht.org/javadoc/org/jgrapht/graph/DefaultEdge.html getSource() and getTarget() are protected (rather than public)? I don't see any sense of them being non-public. |
From: J K. <j.k...@gm...> - 2018-01-06 23:48:53
|
Yes that would work. In Java, any class comes with a constructor, whether you explicitly define it or not. Of course, you would still have to specify a EdgeFactory which creates new instances of your edges. Aside from that, it wouldn't really provide you with a benefit. The edge source and target are stored on the edge. The default types, DefaultEdge or DefaultWeightedEdge extend IntrustiveEdge. Even if your provide your own custom edge type which does not extend IntrusiveEdge, under the hood a Map<YourEdgeType, IntrusiveEdge> will be used which maps your special YourEdgeType edge to a newly created IntrusiveEdge. So in summary, you won't gain anything. For reference, have a look at AbstractBaseGraph, IntrusiveEdgesSpecifics (and one of its implementations UniformIntrusiveEdgesSpecifics). On Sat, Jan 6, 2018 at 1:51 PM, Victor Porton <po...@na...> wrote: > But what if I write the following? > > class MyVoid { > // empty > } > > Graph<T,MyVoid> > > Will this instantiation "work"? > > I ask because it seems to me to store source and target in each edge is > redundant, because in context of its usage the source and target is known. > I ask therefore, if we can use an empty class like MyVoid to avoid storing > source and destination. > > On Sat, 2018-01-06 at 19:56 +0200, Dimitrios Michail wrote: > > Not really. Void is just a placeholder type which cannot be instantiated. > The type you provide for the edges > must be a class that can be instantiated. > > Read about Java Generics in order to understand its purpose ( > https://docs.oracle.com/javase/tutorial/java/generics/index.html). > > There are plenty of examples of graph instantiations in the JGraphT test > cases. > > --Dimitrios > > > On Sat, Jan 6, 2018 at 4:14 PM, Victor Porton <po...@na...> wrote: > > What is the difference between Graph<T,DefaultEdge> and Graph<T,Void>? > > Does the second work? > > ------------------------------------------------------------ > ------------------ > 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 lis...@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 > > |
From: Victor P. <po...@na...> - 2018-01-06 18:52:09
|
But what if I write the following? class MyVoid { // empty } Graph<T,MyVoid> Will this instantiation "work"? I ask because it seems to me to store source and target in each edge is redundant, because in context of its usage the source and target is known. I ask therefore, if we can use an empty class like MyVoid to avoid storing source and destination. On Sat, 2018-01-06 at 19:56 +0200, Dimitrios Michail wrote: > Not really. Void is just a placeholder type which cannot be > instantiated. The type you provide for the edgesmust be a class that > can be instantiated. > > Read about Java Generics in order to understand its purpose (https:// > docs.oracle.com/javase/tutorial/java/generics/index.html). > > There are plenty of examples of graph instantiations in the JGraphT > test cases. > > --Dimitrios > > > > On Sat, Jan 6, 2018 at 4:14 PM, Victor Porton <po...@na...> > wrote: > > What is the difference between Graph<T,DefaultEdge> and > > Graph<T,Void>? > > > > > > > > Does the second work? > > > > > > > > ----------------------------------------------------------------- > > ------------- > > > > 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 |
From: Dimitrios M. <dim...@gm...> - 2018-01-06 17:56:12
|
Not really. Void is just a placeholder type which cannot be instantiated. The type you provide for the edges must be a class that can be instantiated. Read about Java Generics in order to understand its purpose ( https://docs.oracle.com/javase/tutorial/java/generics/index.html). There are plenty of examples of graph instantiations in the JGraphT test cases. --Dimitrios On Sat, Jan 6, 2018 at 4:14 PM, Victor Porton <po...@na...> wrote: > What is the difference between Graph<T,DefaultEdge> and Graph<T,Void>? > > Does the second work? > > ------------------------------------------------------------ > ------------------ > 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 > |
From: Victor P. <po...@na...> - 2018-01-06 14:14:57
|
What is the difference between Graph<T,DefaultEdge> and Graph<T,Void>? Does the second work? |
From: J K. <j.k...@gm...> - 2017-12-28 17:59:27
|
So if edge (x,y) exists in S and edge (y,z) exists in T, then (x,z) must exist in U=S*T. The following simple algorithm would work: for edge (x,y) in S.edgeSet(): for z in T.neighborsOf(y): if (x != z): U.addEdge(x,z) Consider using the following function: Graphs.addEdgeWithVertices(x,z) On Thu, Dec 28, 2017 at 12:38 PM, Victor Porton <po...@na...> wrote: > Let R and S be directed graphs. > > I will denote xTy iff there is an edge from x to y (for digraph T). > > Now I want to calculate the graph R*S defined by the formula: > > x(R*S)z <=> exists y: (xSy and yRz) > > It seems that this is not implemented in JGraphT. > > It seems that I will implement this in near future (unless somebody does > it quicker than me [image: :-)]). > > On Thu, 2017-12-28 at 12:19 -0500, J Kinable wrote: > > You need to be a bit more explicit as what you want/need. I have no idea > what you mean by "composition of binary relations as digraph". There is no > representation of "binary relations". Obviously, there are plenty of > different digraphs and algorithms available. Many algorithms can be easily > implemented using the building blocks that are already present in the > library. > > On Thu, Dec 28, 2017 at 8:55 AM, Victor Porton <po...@na...> wrote: > > I need composition of digraphs (I mean composition of binary relations > represented as digraphs.) in my project. It seems that JGraphT is > missing this operation. > > Is it really missing? > > If it is missing I want to implement it. > > I remind that composition is defined by the formula > > x(R*S)z <=> exists y: (xSy and yRz) > > ------------------------------------------------------------ > ------------------ > 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 > > |
From: Victor P. <po...@na...> - 2017-12-28 17:39:10
|
Let R and S be directed graphs. I will denote xTy iff there is an edge from x to y (for digraph T). Now I want to calculate the graph R*S defined by the formula: x(R*S)z <=> exists y: (xSy and yRz) It seems that this is not implemented in JGraphT. It seems that I will implement this in near future (unless somebody does it quicker than me ). On Thu, 2017-12-28 at 12:19 -0500, J Kinable wrote: > You need to be a bit more explicit as what you want/need. I have no > idea what you mean by "composition of binary relations as digraph". > There is no representation of "binary relations". Obviously, there > are plenty of different digraphs and algorithms available. Many > algorithms can be easily implemented using the building blocks that > are already present in the library. > On Thu, Dec 28, 2017 at 8:55 AM, Victor Porton <po...@na...> > wrote: > > I need composition of digraphs (I mean composition of binary > > relations > > > > represented as digraphs.) in my project. It seems that JGraphT is > > > > missing this operation. > > > > > > > > Is it really missing? > > > > > > > > If it is missing I want to implement it. > > > > > > > > I remind that composition is defined by the formula > > > > > > > > x(R*S)z <=> exists y: (xSy and yRz) > > > > > > > > ----------------------------------------------------------------- > > ------------- > > > > 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 > > |
From: J K. <j.k...@gm...> - 2017-12-28 17:19:57
|
You need to be a bit more explicit as what you want/need. I have no idea what you mean by "composition of binary relations as digraph". There is no representation of "binary relations". Obviously, there are plenty of different digraphs and algorithms available. Many algorithms can be easily implemented using the building blocks that are already present in the library. On Thu, Dec 28, 2017 at 8:55 AM, Victor Porton <po...@na...> wrote: > I need composition of digraphs (I mean composition of binary relations > represented as digraphs.) in my project. It seems that JGraphT is > missing this operation. > > Is it really missing? > > If it is missing I want to implement it. > > I remind that composition is defined by the formula > > x(R*S)z <=> exists y: (xSy and yRz) > > ------------------------------------------------------------ > ------------------ > 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 > |
From: J K. <j.k...@gm...> - 2017-12-28 17:09:47
|
I have no idea about whether you should use Jung or jgrapht, but as far as I know, development of Jung stopped several years ago. 1. Check existence of a path between two vertices. Use of of the (many) shortest path algorithms, or a connectivity inspector. 2. Invert (replace every edge with the opposite edge) a directed graph. Use http://jgrapht.org/javadoc/org/jgrapht/graph/EdgeReversedGraph.html 3. No idea what you want. br, Joris Kinable On Wed, Dec 27, 2017 at 1:27 PM, Victor Porton <po...@na...> wrote: > I am implementing this ambitious free software in Java: > > https://en.wikiversity.org/wiki/Automatic_transformation_of_XML_namespaces > > I need a graph library. I am now choosing JUNG vs JGraphT. > > Now I have the following requirements: > > 1. Check existence of a path between two vertices. > > 2. Invert (replace every edge with the opposite edge) a directed graph. > > 3. Calculate "mathematical" relational composition of two binary relations > represented as directed graphs. > > My requirements may expand in the future. > > Please explain how to do each of my requirements in both JUNG and JGraphT > and help to choose between these two. > > Thanks in advance. > > ------------------------------------------------------------ > ------------------ > 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 > > |
From: Victor P. <po...@na...> - 2017-12-28 14:11:11
|
I need composition of digraphs (I mean composition of binary relations represented as digraphs.) in my project. It seems that JGraphT is missing this operation. Is it really missing? If it is missing I want to implement it. I remind that composition is defined by the formula x(R*S)z <=> exists y: (xSy and yRz) |
From: Victor P. <po...@na...> - 2017-12-27 18:48:04
|
I am implementing this ambitious free software in Java: https://en.wikiversity.org/wiki/Automatic_transformation_of_XML_namespa ces I need a graph library. I am now choosing JUNG vs JGraphT. Now I have the following requirements: 1. Check existence of a path between two vertices. 2. Invert (replace every edge with the opposite edge) a directed graph. 3. Calculate "mathematical" relational composition of two binary relations represented as directed graphs. My requirements may expand in the future. Please explain how to do each of my requirements in both JUNG and JGraphT and help to choose between these two. Thanks in advance. |
From: Adib R. <adi...@gm...> - 2017-11-27 16:11:36
|
Thanks. Actually, I realized that I should use labeled graph for my case which jGrapht supports properly. Thanks, Adib On Mon, Nov 27, 2017 at 10:52 AM, J Kinable <j.k...@gm...> wrote: > Without additional information, your question is impossible to answer. We > cannot see how your graph is constructed, or what the definition of your > TopoVertex is. > Common issues: > 1. Instead of an undirected graph, you create a *directed* graph with an > edge from a to b. Then you query the shortest path from b to a, but there > is no such path. > 2. You did not implement the hashcode/equals functions, see: > https://github.com/jgrapht/jgrapht/wiki/EqualsAndHashCode > > br, > > Joris > > On Sun, Nov 26, 2017 at 10:12 PM, Adib Rastegarnia < > adi...@gm...> wrote: > >> Hello, >> >> I created a graph using jGrapht library which is based on a network >> topology and printed the results as follows: >> >> of:0000000000000191:3,of:0000000000000003:1 >> of:0000000000000191:2,of:0000000000000002:1 >> of:0000000000000192:3,of:0000000000000003:2 >> of:0000000000000192:2,of:0000000000000002:2 >> of:0000000000000191:1,of:0000000000000001:1 >> of:0000000000000192:1,of:0000000000000001:2 >> of:0000000000000003:1,of:0000000000000191:3 >> of:0000000000000003:2,of:0000000000000192:3 >> of:0000000000000002:1,of:0000000000000191:2 >> of:0000000000000001:1,of:0000000000000191:1 >> of:0000000000000002:2,of:0000000000000192:2 >> of:0000000000000001:2,of:0000000000000192:1 >> >> Each vertex in my graph is defined as a device ID and a port number. I >> tried to run a shortest path algorithm to find the shortest path between >> two end points as follows: >> >> DijkstraShortestPath<TopoVertex, TopoEdge> dijkstraAlg = >> new DijkstraShortestPath<>(topoStore.getDirectedGraph()); >> >> TopoVertex src = new TopoVertex("of:0000000000000001", "2"); >> TopoVertex dst = new TopoVertex("of:0000000000000002", "2"); >> ShortestPathAlgorithm.SingleSourcePaths<TopoVertex, TopoEdge> iPaths = dijkstraAlg.getPaths(src); >> System.out.println(iPaths.getPath(dst) + "\n"); >> >> It prints null but there is a path between these two end points. >> >> Any suggestions? >> >> Thanks, >> >> Adib >> >> >> >> >> >> ------------------------------------------------------------ >> ------------------ >> 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 >> >> > |
From: J K. <j.k...@gm...> - 2017-11-27 15:52:36
|
Without additional information, your question is impossible to answer. We cannot see how your graph is constructed, or what the definition of your TopoVertex is. Common issues: 1. Instead of an undirected graph, you create a *directed* graph with an edge from a to b. Then you query the shortest path from b to a, but there is no such path. 2. You did not implement the hashcode/equals functions, see: https://github.com/jgrapht/jgrapht/wiki/EqualsAndHashCode br, Joris On Sun, Nov 26, 2017 at 10:12 PM, Adib Rastegarnia < adi...@gm...> wrote: > Hello, > > I created a graph using jGrapht library which is based on a network > topology and printed the results as follows: > > of:0000000000000191:3,of:0000000000000003:1 > of:0000000000000191:2,of:0000000000000002:1 > of:0000000000000192:3,of:0000000000000003:2 > of:0000000000000192:2,of:0000000000000002:2 > of:0000000000000191:1,of:0000000000000001:1 > of:0000000000000192:1,of:0000000000000001:2 > of:0000000000000003:1,of:0000000000000191:3 > of:0000000000000003:2,of:0000000000000192:3 > of:0000000000000002:1,of:0000000000000191:2 > of:0000000000000001:1,of:0000000000000191:1 > of:0000000000000002:2,of:0000000000000192:2 > of:0000000000000001:2,of:0000000000000192:1 > > Each vertex in my graph is defined as a device ID and a port number. I > tried to run a shortest path algorithm to find the shortest path between > two end points as follows: > > DijkstraShortestPath<TopoVertex, TopoEdge> dijkstraAlg = > new DijkstraShortestPath<>(topoStore.getDirectedGraph()); > > TopoVertex src = new TopoVertex("of:0000000000000001", "2"); > TopoVertex dst = new TopoVertex("of:0000000000000002", "2"); > ShortestPathAlgorithm.SingleSourcePaths<TopoVertex, TopoEdge> iPaths = dijkstraAlg.getPaths(src); > System.out.println(iPaths.getPath(dst) + "\n"); > > It prints null but there is a path between these two end points. > > Any suggestions? > > Thanks, > > Adib > > > > > > ------------------------------------------------------------ > ------------------ > 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 > > |
From: Adib R. <adi...@gm...> - 2017-11-27 03:12:29
|
Hello, I created a graph using jGrapht library which is based on a network topology and printed the results as follows: of:0000000000000191:3,of:0000000000000003:1 of:0000000000000191:2,of:0000000000000002:1 of:0000000000000192:3,of:0000000000000003:2 of:0000000000000192:2,of:0000000000000002:2 of:0000000000000191:1,of:0000000000000001:1 of:0000000000000192:1,of:0000000000000001:2 of:0000000000000003:1,of:0000000000000191:3 of:0000000000000003:2,of:0000000000000192:3 of:0000000000000002:1,of:0000000000000191:2 of:0000000000000001:1,of:0000000000000191:1 of:0000000000000002:2,of:0000000000000192:2 of:0000000000000001:2,of:0000000000000192:1 Each vertex in my graph is defined as a device ID and a port number. I tried to run a shortest path algorithm to find the shortest path between two end points as follows: DijkstraShortestPath<TopoVertex, TopoEdge> dijkstraAlg = new DijkstraShortestPath<>(topoStore.getDirectedGraph()); TopoVertex src = new TopoVertex("of:0000000000000001", "2"); TopoVertex dst = new TopoVertex("of:0000000000000002", "2"); ShortestPathAlgorithm.SingleSourcePaths<TopoVertex, TopoEdge> iPaths = dijkstraAlg.getPaths(src); System.out.println(iPaths.getPath(dst) + "\n"); It prints null but there is a path between these two end points. Any suggestions? Thanks, Adib |
From: John S. <js...@gm...> - 2017-11-15 01:20:47
|
We've just merged the complete removal of the deprecated undirected/directed/weighted graph interfaces into trunk. So, apps which depend on them (that is, most apps which use JGraphT) will need to be updated in order to be able to use versions of JGraphT past the latest (1.1) release. Joris, thanks as always for the release work! ---------- Forwarded message ---------- From: J Kinable <j.k...@gm...> Date: Tue, Nov 14, 2017 at 4:58 AM Subject: [jgrapht-announce] JGraphT version 1.1 released To: jgr...@li..., jgr...@li... Hi all, JGraphtT version 1.1 has been released! As always, thank you for your contributions. This release significantly reduces the number of different Graph interfaces: the interfaces UndirectedGraph, DirectedGraph and WeightedGraph have been deprecated. Instead, their functionality is captured in one, simple, clean *Graph* interface. This makes it much easier to implement algorithms, methods and classes which can work with various different graph types. For a full list of changes, refer to https://github.com/jgrapht/jgrapht /blob/master/HISTORY.md cheers, Joris Kinable ------------------------------------------------------------ ------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ jgrapht-announce mailing list jgr...@li... https://lists.sourceforge.net/lists/listinfo/jgrapht-announce |
From: J K. <j.k...@gm...> - 2017-11-14 12:58:39
|
Hi all, JGraphtT version 1.1 has been released! As always, thank you for your contributions. This release significantly reduces the number of different Graph interfaces: the interfaces UndirectedGraph, DirectedGraph and WeightedGraph have been deprecated. Instead, their functionality is captured in one, simple, clean *Graph* interface. This makes it much easier to implement algorithms, methods and classes which can work with various different graph types. For a full list of changes, refer to https://github.com/jgrapht/jgrapht /blob/master/HISTORY.md cheers, Joris Kinable |
From: J K. <j.k...@gm...> - 2017-09-14 11:13:41
|
Currently there's no build-in function which can do that automatically for you. We are currently making this functionality available somewhere in the next few weeks, see Pull Request: https://github.com/jgrapht/jgrapht/pull/423 In the mean time, to get the desired behavior, you could implement your own DepthFirstSearch iterator. Or more conveniently, just copy mine: https://github.com/jkinable/jgrapht/blob/95daef5a6826818d00e113ac610415a763c5aee0/jgrapht-core/src/main/java/org/jgrapht/traverse/DepthFirstIterator.java This iterator has a new function getDepth(V v) which allows you to query the depth of a specific node (after the DFS completes, or after the node has been visited). So in order to query all nodes at a certain depth, you could write an additional function: //cache the nodes at a given depth Map<Integer,Set<V>> depthMap=new HashMap<>(); for(V v : graph.vertexSet()){ int depth=dfs.getDepth(v); if(!depthMap.containsKey(depth)) depthMap.put(depth, new HashSet<V>()); depthMap.get(depth).add(v); } Now you can easily query all nodes at a given depth: depthMap.get(3); On Thu, Sep 14, 2017 at 1:00 PM, Bobi Adji Andov <bob...@gm...> wrote: > Hello all, > > I am a new user to JGraphT and as every other newbie I am running into > ideas that I would like to solve with this library, but I am still not sure > how to do that. > > I am building a directed graph and I am wandering is there a way to get > all the nodes at certain depth (starting from a vertex). For example > something like get all nodes at depth 3 from certain vertex. > > Thanks in advance, > Slobodan > > -- > > > > *Slobodan Adji-Andovskype:bobiadziandov* > > ------------------------------------------------------------ > ------------------ > 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 > > |
From: Bobi A. A. <bob...@gm...> - 2017-09-14 11:00:39
|
Hello all, I am a new user to JGraphT and as every other newbie I am running into ideas that I would like to solve with this library, but I am still not sure how to do that. I am building a directed graph and I am wandering is there a way to get all the nodes at certain depth (starting from a vertex). For example something like get all nodes at depth 3 from certain vertex. Thanks in advance, Slobodan -- *Slobodan Adji-Andovskype:bobiadziandov* |
From: J K. <j.k...@gm...> - 2017-09-07 21:50:11
|
We are in the process of finalizing the next release of jgrapht, version 1.1. The release is scheduled for sometime this month. This release contains some major changes, including various simplifications to the graph interfaces. Moreover, several algorithms have been re-implemented, thereby adapting them to accept both directed and undirected graphs, while at the same time improving their overall performance. If you have any last-minute changes you would like to make available for the upcoming release, then this is the time to submit them (pull request or create a new issue). Similarly, if you still have open PRs lingering around, please fix any comments by the reviewers. br, Joris Kinable |
From: J K. <j.k...@gm...> - 2017-08-17 20:18:24
|
Please address your replies to the entire list, not to me in person: this increases the likelihood that the original author of the algorithm chimes in. I'm unfortunately not familiar with the VF2 algorithm, or its implementation in jgrapht. I'd recommend to repeat your experiment. Keep your experiment as simple as possible to eliminate potential (common) causes of bugs. E.g.: 1. use Graph<Integer, DefaultEdge> g1=new SimpleGraph<>(DefaultEdge.class); for both graphs (instead of directed graphs which are cast to undirected graphs). 2. use Integer as vertex data type, not String. Finally: 1. Since checking whether 2 graphs are isomorphic is generally hard, please verify whether VF2 is a complete (exact) algorithm. 2. Provide a mapping from the vertices of g1 to the vertices of g2 to prove that the graphs are indeed isomorphic. If the graphs are indeed isomorphic, the algorithm is exact, and the algorithm returns false, please feel free to file a bug report using our issue tracker: https://github.com/jgrapht/jgrapht/issues Alternatively, if you are convinced that this is a bug, feel free to have a look at the source code (https://github.com/jgrapht/jgrapht) . The algorithm seems pretty short, so it may not be very hard to track down what's going wrong. thanks, Joris Kinable On Thu, Aug 17, 2017 at 2:37 PM, murad tukan <mur...@gm...> wrote: > Dear Joris, > > I have attached bellow the code for checking the isomorphism: > > > public class testing3 { > > private static DefaultDirectedGraph<String, DefaultEdge> graph1, > graph2; > private static IsomorphismInspector<String, DefaultEdge> inspector; > > > public static void main(String[] args) > { > > > graph1 = new DefaultDirectedGraph<String, > DefaultEdge>(DefaultEdge.class); > graph2 = new DefaultDirectedGraph<String, > DefaultEdge>(DefaultEdge.class); > > // graph1 > for(int i = 1; i <= 6; ++i) > { > graph1.addVertex(Integer.toString(i)); > graph2.addVertex(Integer.toString(i)); > } > > graph1.addEdge("1", "2"); > graph1.addEdge("2", "1"); > graph1.addEdge("1", "3"); > graph1.addEdge("3", "1"); > graph1.addEdge("1", "6"); > graph1.addEdge("6", "1"); > graph1.addEdge("2", "4"); > graph1.addEdge("4", "2"); > graph1.addEdge("2", "5"); > graph1.addEdge("5", "2"); > graph1.addEdge("3", "4"); > graph1.addEdge("4", "3"); > graph1.addEdge("3", "5"); > graph1.addEdge("5", "3"); > graph1.addEdge("4", "6"); > graph1.addEdge("6", "4"); > graph1.addEdge("5", "6"); > graph1.addEdge("6", "5"); > > > // graph2 > graph2.addEdge("1", "2"); > graph2.addEdge("2", "1"); > graph2.addEdge("1", "3"); > graph2.addEdge("3", "1"); > graph2.addEdge("1", "6"); > graph2.addEdge("6", "1"); > graph2.addEdge("2", "3"); > graph2.addEdge("3", "2"); > graph2.addEdge("2", "4"); > graph2.addEdge("4", "2"); > graph2.addEdge("3", "5"); > graph2.addEdge("5", "3"); > graph2.addEdge("4", "5"); > graph2.addEdge("5", "4"); > graph2.addEdge("4", "6"); > graph2.addEdge("6", "4"); > graph2.addEdge("5", "6"); > graph2.addEdge("6", "5"); > > UndirectedGraph<String, DefaultEdge> g1 = new > AsUndirectedGraph<String, DefaultEdge>(graph1); > UndirectedGraph<String, DefaultEdge> g2 = new > AsUndirectedGraph<String, DefaultEdge>(graph2); > > inspector = new VF2GraphIsomorphismInspector<String, > DefaultEdge>(g1,g2); > System.err.println(inspector.isomorphismExists()); > } > > } > > For such graph, the result should be true rather than false (Also i > checked using MATLAB graph isomorphism solver and it returned true). > > To get more intuition why the two graphs are isomorphic, see the actual > graphs: > > [image: Inline image 2] > > > Please advise. > > Thanks in advance, > M.T. > > P.s. Also tried using SimpleGraph and still got false in term of > isomorphic or not. > > On Thu, Aug 17, 2017 at 7:48 AM, J Kinable <j.k...@gm...> wrote: > >> Hi, >> >> Can you be a bit more specific? What is the graph you are testing on? Can >> you show a code snippet. Preferably provide a small working example, and >> describe the expected output. >> >> br, >> >> Joris Kinable >> >> On Wed, Aug 16, 2017 at 9:59 PM, murad tukan <mur...@gm...> wrote: >> >>> Dear sir/madam, >>> >>> I have tried your vf2 algorithm a.k.a. VF2GraphIsomorphismInspector on >>> the following graphs by replacing each edge by two directional edges such >>> that each is in opposite direction in order to obtain a directed graph. >>> The algorithm returned false when it should have returned true. >>> >>> Is there a bug in the implementation of VF2 or I misrepresented the >>> graphs? >>> >>> Please advise as soon as possible. >>> >>> Thanks in advance, >>> M.T. >>> >>> ------------------------------------------------------------ >>> ------------------ >>> 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 >>> >>> >> > |
From: J K. <j.k...@gm...> - 2017-08-17 11:49:02
|
Hi, Can you be a bit more specific? What is the graph you are testing on? Can you show a code snippet. Preferably provide a small working example, and describe the expected output. br, Joris Kinable On Wed, Aug 16, 2017 at 9:59 PM, murad tukan <mur...@gm...> wrote: > Dear sir/madam, > > I have tried your vf2 algorithm a.k.a. VF2GraphIsomorphismInspector on the > following graphs by replacing each edge by two directional edges such that > each is in opposite direction in order to obtain a directed graph. > The algorithm returned false when it should have returned true. > > Is there a bug in the implementation of VF2 or I misrepresented the graphs? > > Please advise as soon as possible. > > Thanks in advance, > M.T. > > ------------------------------------------------------------ > ------------------ > 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 > > |
From: murad t. <mur...@gm...> - 2017-08-17 02:00:20
|
Dear sir/madam, I have tried your vf2 algorithm a.k.a. VF2GraphIsomorphismInspector on the following graphs by replacing each edge by two directional edges such that each is in opposite direction in order to obtain a directed graph. The algorithm returned false when it should have returned true. Is there a bug in the implementation of VF2 or I misrepresented the graphs? Please advise as soon as possible. Thanks in advance, M.T. |
From: Michał U. <mic...@op...> - 2017-05-28 19:07:31
|
ello I've created graph using JGraphT library g = new ListenableUndirectedWeightedGraph <String, MyEdge>(MyEdge.class); graphAdapter = new JGraphXAdapter<String, MyEdge>(g); layout = new mxOrganicLayout(graphAdapter); layout.execute(graphAdapter.getDefaultParent()); mxGraphComponent component = new mxGraphComponent(graphAdapter); component.setPreferredSize(new Dimension(dim.width - 50, dim.height - 200)); add(component); and I want to add dynamically a new vertex after pushing the button @Override public void actionPerformed(ActionEvent e) { String a="1"; String b="2"; g.addVertex(a); g.addVertex(b); g.addEdge(a,b); } public static class MyEdge extends DefaultWeightedEdge { //weight @Override public String toString() { return String.valueOf(getWeight()); } } how can I refresh the view? |