jgrapht-users Mailing List for JGraphT (Page 16)
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: Simon H. <sim...@gm...> - 2014-04-22 08:52:11
|
Hello jGraphT users, I think I found a bug in the HamiltonianCycle algorithm. I wrote it down in detail here: https://github.com/jgrapht/jgrapht/issues/83 If someone has an idea why this happens, it would be great to get some feedback about this. Thanks, Simon |
From: Rikless <eri...@gm...> - 2014-04-01 17:58:12
|
Thanks a lot ! -- View this message in context: http://jgrapht-users.107614.n3.nabble.com/Label-Edge-Example-tp4024899p4024913.html Sent from the jgrapht-users mailing list archive at Nabble.com. |
From: Sebastian M. <woo...@gm...> - 2014-04-01 12:00:17
|
Wolfram MathWorld explains it well: " Some references require that multigraphs possess no graph loops, some explicitly allow them, and yet others do not include any explicit allowance or disallowance. Worse still, Tutte uses the term "multigraph" to mean a graph containing either loops or multiple edges. As a result of these many ambiguities, use of the term "multigraph" should be deprecated, or at the very least used with extreme caution. " http://mathworld.wolfram.com/Multigraph.html Sebastian On 04/01/2014 01:54 PM, Szabolcs Besenyei wrote: > Hi! > > A multidigraph by definition is a directed graph which is permitted to > have multiple edges with the same source and target nodes/. > / > It can also allow loops, however some like to call these > *pseudographs*/,/ reserving the term multigraph for the case with no > loops. > Jgrapht is implemented to preseve this distinction. > / > / > So to answer your question in short, DirectedPseudograph is the > structure you are looking for. > > Szabolcs > // > > > 2014-04-01 0:06 GMT+02:00 Rikless <eri...@gm... > <mailto:eri...@gm...>>: > > Hi, > > I come back on this post because i had the same problem on an old > algorithm > using a DirectedWeightedMultigraph structure. > > I know that there is loops on my data, that's why i choosed this > structure. > As mentionned in the javadoc : > *DirectedMultigraph* (used by Patricia) : A directed multigraph is a > non-simple directed graph in which loops and multiple edges > between any two > vertices are permitted. > *DirectedWeightedMultigraph* : A directed weighted multigraph is a > non-simple directed graph in which loops and multiple edges > between any two > vertices are permitted, and edges have weights. > > I think something have changed since version 0.9.0. > > Any idea ? > What is the structure i can use with loops and multiple edges ? > > Rik > > > > > > -- > View this message in context: > http://jgrapht-users.107614.n3.nabble.com/Label-Edge-Example-tp4024899p4024909.html > Sent from the jgrapht-users mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > _______________________________________________ > jgrapht-users mailing list > jgr...@li... > <mailto:jgr...@li...> > https://lists.sourceforge.net/lists/listinfo/jgrapht-users > > > > > ------------------------------------------------------------------------------ > > > _______________________________________________ > jgrapht-users mailing list > jgr...@li... > https://lists.sourceforge.net/lists/listinfo/jgrapht-users |
From: Sebastian M. <woo...@gm...> - 2014-04-01 11:55:33
|
I believe there was a discussion about this last year. See change here: https://github.com/jgrapht/jgrapht/commit/8fe299c38648acac55e40bd47498a08269e01f74 You can use a DirectedPseudograph in your case. http://jgrapht.org/javadoc/index.html?org/jgrapht/graph/DirectedWeightedPseudograph.html Sebastian On 04/01/2014 12:06 AM, Rikless wrote: > Hi, > > I come back on this post because i had the same problem on an old algorithm > using a DirectedWeightedMultigraph structure. > > I know that there is loops on my data, that's why i choosed this structure. > As mentionned in the javadoc : > *DirectedMultigraph* (used by Patricia) : A directed multigraph is a > non-simple directed graph in which loops and multiple edges between any two > vertices are permitted. > *DirectedWeightedMultigraph* : A directed weighted multigraph is a > non-simple directed graph in which loops and multiple edges between any two > vertices are permitted, and edges have weights. > > I think something have changed since version 0.9.0. > > Any idea ? > What is the structure i can use with loops and multiple edges ? > > Rik > > > > > > -- > View this message in context: http://jgrapht-users.107614.n3.nabble.com/Label-Edge-Example-tp4024899p4024909.html > Sent from the jgrapht-users mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > _______________________________________________ > jgrapht-users mailing list > jgr...@li... > https://lists.sourceforge.net/lists/listinfo/jgrapht-users |
From: Szabolcs B. <bes...@gm...> - 2014-04-01 11:54:19
|
Hi! A multidigraph by definition is a directed graph which is permitted to have multiple edges with the same source and target nodes *.* It can also allow loops, however some like to call these *pseudographs**,*reserving the term multigraph for the case with no loops. Jgrapht is implemented to preseve this distinction. So to answer your question in short, DirectedPseudograph is the structure you are looking for. Szabolcs 2014-04-01 0:06 GMT+02:00 Rikless <eri...@gm...>: > Hi, > > I come back on this post because i had the same problem on an old algorithm > using a DirectedWeightedMultigraph structure. > > I know that there is loops on my data, that's why i choosed this structure. > As mentionned in the javadoc : > *DirectedMultigraph* (used by Patricia) : A directed multigraph is a > non-simple directed graph in which loops and multiple edges between any two > vertices are permitted. > *DirectedWeightedMultigraph* : A directed weighted multigraph is a > non-simple directed graph in which loops and multiple edges between any two > vertices are permitted, and edges have weights. > > I think something have changed since version 0.9.0. > > Any idea ? > What is the structure i can use with loops and multiple edges ? > > Rik > > > > > > -- > View this message in context: > http://jgrapht-users.107614.n3.nabble.com/Label-Edge-Example-tp4024899p4024909.html > Sent from the jgrapht-users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > _______________________________________________ > jgrapht-users mailing list > jgr...@li... > https://lists.sourceforge.net/lists/listinfo/jgrapht-users > |
From: Rikless <eri...@gm...> - 2014-03-31 22:06:16
|
Hi, I come back on this post because i had the same problem on an old algorithm using a DirectedWeightedMultigraph structure. I know that there is loops on my data, that's why i choosed this structure. As mentionned in the javadoc : *DirectedMultigraph* (used by Patricia) : A directed multigraph is a non-simple directed graph in which loops and multiple edges between any two vertices are permitted. *DirectedWeightedMultigraph* : A directed weighted multigraph is a non-simple directed graph in which loops and multiple edges between any two vertices are permitted, and edges have weights. I think something have changed since version 0.9.0. Any idea ? What is the structure i can use with loops and multiple edges ? Rik -- View this message in context: http://jgrapht-users.107614.n3.nabble.com/Label-Edge-Example-tp4024899p4024909.html Sent from the jgrapht-users mailing list archive at Nabble.com. |
From: Patricia_Sim <pt...@gm...> - 2014-03-26 06:18:43
|
Thank you very much Patricia On Thu, Mar 20, 2014 at 4:29 AM, Szabolcs Besenyei [via jgrapht-users] < ml-...@n3...> wrote: > Hi! > > The problem here is that DirectedMultigraph doest not allow loops and in > your first loop you are trying to do > >> graph.addEdge(people.get(0), person, new >> RelationshipEdge<String>(people.get(0), person, friend)); >> > which translates to > >> graph.addEdge("John", "John", new RelationshipEdge<String>("John", >> "John", friend)); on the first iteration. >> > > Your option here is to either use a DefaultDirectedGraph (a non-simple > directed graph in which multiple edges between any two vertices are *not*permitted, but loops are) or rewrite your code so that it does not try to > friend John with "himself". > > > > 2014-03-15 16:18 GMT+01:00 Patricia_Sim <[hidden email]<http://user/SendEmail.jtp?type=node&node=4024901&i=0> > >: > > Hi Everybody >> >> I'm trying to create directed graph with label edge by jgrapht. I learn >> how >> to create by "LabeledEdges" example which source code shown below >> >> public class LabeledEdges { >> private static final String friend = "friend"; >> private static final String enemy = "enemy"; >> >> public static void main(String[] args) { >> DirectedGraph<String, RelationshipEdge> graph = >> new DirectedMultigraph<String, RelationshipEdge>( >> new ClassBasedEdgeFactory<String, >> RelationshipEdge>(RelationshipEdge.class)); >> >> ArrayList<String> people = new ArrayList<String>(); >> people.add("John"); >> people.add("James"); >> people.add("Sarah"); >> people.add("Jessica"); >> >> // John is everyone's friend >> for (String person : people) { >> graph.addVertex(person); >> graph.addEdge(people.get(0), person, new >> RelationshipEdge<String>(people.get(0), person, friend)); >> } >> >> // Apparently James doesn't really like John >> graph.addEdge("James", "John", new >> RelationshipEdge<String>("James", >> "John", enemy)); >> >> // Jessica is Sarah and James's friend >> graph.addEdge("Jessica", "Sarah", new >> RelationshipEdge<String>("Jessica", "Sarah", friend)); >> graph.addEdge("Jessica", "James", new >> RelationshipEdge<String>("Jessica", "James", friend)); >> >> // But Sarah doesn't really like James >> graph.addEdge("Sarah", "James", new >> RelationshipEdge<String>("Sarah", "James", enemy)); >> >> for (RelationshipEdge edge : graph.edgeSet()) { >> if (edge.toString().equals("enemy")) { >> System.out.printf(edge.getV1()+"is an enemy of "+ >> edge.getV2()+"\n"); >> } else if (edge.toString().equals("friend")) { >> System.out.printf( edge.getV1()+" is a friend of "+ >> edge.getV2()+"\n"); >> } >> } >> } >> >> public static class RelationshipEdge<V> extends DefaultEdge { >> private V v1; >> private V v2; >> private String label; >> >> public RelationshipEdge(V v1, V v2, String label) { >> this.v1 = v1; >> this.v2 = v2; >> this.label = label; >> } >> >> public V getV1() { >> return v1; >> } >> >> public V getV2() { >> return v2; >> } >> >> public String toString() { >> return label; >> } >> } >> >> However, when I run this example, it show the error message >> "Exception in thread "main" java.lang.IllegalArgumentException: >> loops not allowed >> at >> org.jgrapht.graph.AbstractBaseGraph.addEdge(AbstractBaseGraph.java:243)" >> >> How can I do to run this example >> >> >> >> -- >> View this message in context: >> http://jgrapht-users.107614.n3.nabble.com/Label-Edge-Example-tp4024899.html >> Sent from the jgrapht-users mailing list archive at Nabble.com. >> >> >> ------------------------------------------------------------------------------ >> Learn Graph Databases - Download FREE O'Reilly Book >> "Graph Databases" is the definitive new guide to graph databases and their >> applications. Written by three acclaimed leaders in the field, >> this first edition is now available. Download your free book today! >> http://p.sf.net/sfu/13534_NeoTech >> _______________________________________________ >> jgrapht-users mailing list >> [hidden email] <http://user/SendEmail.jtp?type=node&node=4024901&i=1> >> https://lists.sourceforge.net/lists/listinfo/jgrapht-users >> > > > ------------------------------------------------------------------------------ > > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/13534_NeoTech > _______________________________________________ > jgrapht-users mailing list > [hidden email] <http://user/SendEmail.jtp?type=node&node=4024901&i=2> > https://lists.sourceforge.net/lists/listinfo/jgrapht-users > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://jgrapht-users.107614.n3.nabble.com/Label-Edge-Example-tp4024899p4024901.html > To unsubscribe from Label Edge Example, click here<http://jgrapht-users.107614.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4024899&code=cHRyY3NpbUBnbWFpbC5jb218NDAyNDg5OXw1MDUxMDM2NTc=> > . > NAML<http://jgrapht-users.107614.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://jgrapht-users.107614.n3.nabble.com/Label-Edge-Example-tp4024899p4024908.html Sent from the jgrapht-users mailing list archive at Nabble.com. |
From: Joris K. <de...@gm...> - 2014-03-23 21:35:11
|
Hi John, Thanks for your effort! A NullPointerException if perfectly fine and indeed a better choice than the UnsupportedArgumentException. br, Joris On Fri, Mar 21, 2014 at 6:14 PM, John Sichi <js...@gm...> wrote: > I'll make the change (but I think for consistency with existing code, > I'll use NullPointerException instead of > UnsupportedArgumentException). > > On Fri, Mar 21, 2014 at 1:02 PM, Alex Moir > <am...@di...> wrote: > > Good catch, I agree. > > > > > > > > From: Javier MV [mailto:jav...@dc...] > > Sent: Friday, March 21, 2014 12:56 PM > > To: jgr...@li... > > Subject: Re: [jgrapht-users] getEdgeWeight in weighted Graph > > > > > > > > +1 > > > > > > > > On Fri, Mar 21, 2014 at 4:01 PM, Georg Hieronimus > > <geo...@go...> wrote: > > > > i strongly agree with your suggestion. > > > > i already had the problem by myself, but forgot to write a pull request > > afterwards .... > > > > It's quiet horrible to find bugs, if you dont know about the current > > behavior. > > > > > > > > On 21 March 2014 19:56, Joris Kinable <de...@gm...> wrote: > > > > Dear, > > > > > > > > In the latest version of jgrapht (and perhaps also in other versions), > the > > getEdgeWeight(E e) function is implemented as follows: > > > > > > > > public double getEdgeWeight(E e) > > > > { > > > > if (e instanceof DefaultWeightedEdge) { > > > > return ((DefaultWeightedEdge) e).getWeight(); > > > > } else { > > > > return WeightedGraph.DEFAULT_EDGE_WEIGHT; > > > > } > > > > } > > > > > > > > > > > > If e==null, i.e. the edge does not exist, then this function will return > > DEFAULT_EDGE_WEIGHT. This is strange as often invoking the getEdgeWeight > > function on a non-existing edge is simply a bug. > > > > > > > > I would suggest to modify the above function to something like: > > > > public double getEdgeWeight(E e) > > > > { > > > > if (e instanceof DefaultWeightedEdge) { > > > > return ((DefaultWeightedEdge) e).getWeight(); > > > > } else if(e==null){ > > > > throw new UnsupportedArgumentException("Edge cannot be null"); > > > > }else{ > > > > return WeightedGraph.DEFAULT_EDGE_WEIGHT; > > > > } > > > > } > > > > > > > > One common error would be something like: > > > > Edge e=graph.getEdge(i,j); //Edge (i,j) is not part of the graph, so > > e==null; > > > > cost += graph.getEdgeWeight(e); //Correct, does not invoke an exception > > > > > > > > > > > > At the very least, the javadoc for the getEdgeWeight function should > mention > > the above pitfall by specify that invoking the getEdgeWeight function on > > null returns WeightedGraph.DEFAULT_EDGE_WEIGHT so it's the user's > problem to > > check whether the edge is not equal to null. > > > > > > > > This is just a suggestion. If there is support for this change, I'll > make a > > change request. > > > > > > > > br, > > > > > > > > Joris > > > > > > > > > ------------------------------------------------------------------------------ > > Learn Graph Databases - Download FREE O'Reilly Book > > "Graph Databases" is the definitive new guide to graph databases and > their > > applications. Written by three acclaimed leaders in the field, > > this first edition is now available. Download your free book today! > > http://p.sf.net/sfu/13534_NeoTech > > _______________________________________________ > > jgrapht-users mailing list > > jgr...@li... > > https://lists.sourceforge.net/lists/listinfo/jgrapht-users > > > > > > > > > > > ------------------------------------------------------------------------------ > > Learn Graph Databases - Download FREE O'Reilly Book > > "Graph Databases" is the definitive new guide to graph databases and > their > > applications. Written by three acclaimed leaders in the field, > > this first edition is now available. Download your free book today! > > http://p.sf.net/sfu/13534_NeoTech > > _______________________________________________ > > jgrapht-users mailing list > > jgr...@li... > > https://lists.sourceforge.net/lists/listinfo/jgrapht-users > > > > > > > > > > -- > > Javier MV > > > > > > > ------------------------------------------------------------------------------ > > Learn Graph Databases - Download FREE O'Reilly Book > > "Graph Databases" is the definitive new guide to graph databases and > their > > applications. Written by three acclaimed leaders in the field, > > this first edition is now available. Download your free book today! > > http://p.sf.net/sfu/13534_NeoTech > > _______________________________________________ > > jgrapht-users mailing list > > jgr...@li... > > https://lists.sourceforge.net/lists/listinfo/jgrapht-users > > > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/13534_NeoTech > _______________________________________________ > jgrapht-users mailing list > jgr...@li... > https://lists.sourceforge.net/lists/listinfo/jgrapht-users > |
From: John S. <js...@gm...> - 2014-03-21 22:14:35
|
I'll make the change (but I think for consistency with existing code, I'll use NullPointerException instead of UnsupportedArgumentException). On Fri, Mar 21, 2014 at 1:02 PM, Alex Moir <am...@di...> wrote: > Good catch, I agree. > > > > From: Javier MV [mailto:jav...@dc...] > Sent: Friday, March 21, 2014 12:56 PM > To: jgr...@li... > Subject: Re: [jgrapht-users] getEdgeWeight in weighted Graph > > > > +1 > > > > On Fri, Mar 21, 2014 at 4:01 PM, Georg Hieronimus > <geo...@go...> wrote: > > i strongly agree with your suggestion. > > i already had the problem by myself, but forgot to write a pull request > afterwards .... > > It's quiet horrible to find bugs, if you dont know about the current > behavior. > > > > On 21 March 2014 19:56, Joris Kinable <de...@gm...> wrote: > > Dear, > > > > In the latest version of jgrapht (and perhaps also in other versions), the > getEdgeWeight(E e) function is implemented as follows: > > > > public double getEdgeWeight(E e) > > { > > if (e instanceof DefaultWeightedEdge) { > > return ((DefaultWeightedEdge) e).getWeight(); > > } else { > > return WeightedGraph.DEFAULT_EDGE_WEIGHT; > > } > > } > > > > > > If e==null, i.e. the edge does not exist, then this function will return > DEFAULT_EDGE_WEIGHT. This is strange as often invoking the getEdgeWeight > function on a non-existing edge is simply a bug. > > > > I would suggest to modify the above function to something like: > > public double getEdgeWeight(E e) > > { > > if (e instanceof DefaultWeightedEdge) { > > return ((DefaultWeightedEdge) e).getWeight(); > > } else if(e==null){ > > throw new UnsupportedArgumentException("Edge cannot be null"); > > }else{ > > return WeightedGraph.DEFAULT_EDGE_WEIGHT; > > } > > } > > > > One common error would be something like: > > Edge e=graph.getEdge(i,j); //Edge (i,j) is not part of the graph, so > e==null; > > cost += graph.getEdgeWeight(e); //Correct, does not invoke an exception > > > > > > At the very least, the javadoc for the getEdgeWeight function should mention > the above pitfall by specify that invoking the getEdgeWeight function on > null returns WeightedGraph.DEFAULT_EDGE_WEIGHT so it's the user's problem to > check whether the edge is not equal to null. > > > > This is just a suggestion. If there is support for this change, I'll make a > change request. > > > > br, > > > > Joris > > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/13534_NeoTech > _______________________________________________ > jgrapht-users mailing list > jgr...@li... > https://lists.sourceforge.net/lists/listinfo/jgrapht-users > > > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/13534_NeoTech > _______________________________________________ > jgrapht-users mailing list > jgr...@li... > https://lists.sourceforge.net/lists/listinfo/jgrapht-users > > > > > -- > Javier MV > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/13534_NeoTech > _______________________________________________ > jgrapht-users mailing list > jgr...@li... > https://lists.sourceforge.net/lists/listinfo/jgrapht-users > |
From: Alex M. <am...@di...> - 2014-03-21 20:20:41
|
Good catch, I agree. From: Javier MV [mailto:jav...@dc...] Sent: Friday, March 21, 2014 12:56 PM To: jgr...@li... Subject: Re: [jgrapht-users] getEdgeWeight in weighted Graph +1 On Fri, Mar 21, 2014 at 4:01 PM, Georg Hieronimus <geo...@go...> wrote: i strongly agree with your suggestion. i already had the problem by myself, but forgot to write a pull request afterwards .... It's quiet horrible to find bugs, if you dont know about the current behavior. On 21 March 2014 19:56, Joris Kinable <de...@gm...> wrote: Dear, In the latest version of jgrapht (and perhaps also in other versions), the getEdgeWeight(E e) function is implemented as follows: public double getEdgeWeight(E e) { if (e instanceof DefaultWeightedEdge) { return ((DefaultWeightedEdge) e).getWeight(); } else { return WeightedGraph.DEFAULT_EDGE_WEIGHT; } } If e==null, i.e. the edge does not exist, then this function will return DEFAULT_EDGE_WEIGHT. This is strange as often invoking the getEdgeWeight function on a non-existing edge is simply a bug. I would suggest to modify the above function to something like: public double getEdgeWeight(E e) { if (e instanceof DefaultWeightedEdge) { return ((DefaultWeightedEdge) e).getWeight(); } else if(e==null){ throw new UnsupportedArgumentException("Edge cannot be null"); }else{ return WeightedGraph.DEFAULT_EDGE_WEIGHT; } } One common error would be something like: Edge e=graph.getEdge(i,j); //Edge (i,j) is not part of the graph, so e==null; cost += graph.getEdgeWeight(e); //Correct, does not invoke an exception At the very least, the javadoc for the getEdgeWeight function should mention the above pitfall by specify that invoking the getEdgeWeight function on null returns WeightedGraph.DEFAULT_EDGE_WEIGHT so it's the user's problem to check whether the edge is not equal to null. This is just a suggestion. If there is support for this change, I'll make a change request. br, Joris ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech _______________________________________________ jgrapht-users mailing list jgr...@li... https://lists.sourceforge.net/lists/listinfo/jgrapht-users ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech _______________________________________________ jgrapht-users mailing list jgr...@li... https://lists.sourceforge.net/lists/listinfo/jgrapht-users -- Javier MV |
From: Javier MV <jav...@dc...> - 2014-03-21 19:56:03
|
+1 On Fri, Mar 21, 2014 at 4:01 PM, Georg Hieronimus < geo...@go...> wrote: > i strongly agree with your suggestion. > i already had the problem by myself, but forgot to write a pull request > afterwards .... > It's quiet horrible to find bugs, if you dont know about the current > behavior. > > > On 21 March 2014 19:56, Joris Kinable <de...@gm...> wrote: > >> Dear, >> >> In the latest version of jgrapht (and perhaps also in other versions), >> the getEdgeWeight(E e) function is implemented as follows: >> >> public double getEdgeWeight(E e) >> { >> if (e instanceof DefaultWeightedEdge) { >> return ((DefaultWeightedEdge) e).getWeight(); >> } else { >> return WeightedGraph.DEFAULT_EDGE_WEIGHT; >> } >> } >> >> >> If e==null, i.e. the edge does not exist, then this function will return >> DEFAULT_EDGE_WEIGHT. This is strange as often invoking the getEdgeWeight >> function on a non-existing edge is simply a bug. >> >> I would suggest to modify the above function to something like: >> public double getEdgeWeight(E e) >> { >> if (e instanceof DefaultWeightedEdge) { >> return ((DefaultWeightedEdge) e).getWeight(); >> } else if(e==null){ >> throw new UnsupportedArgumentException("Edge cannot be null"); >> }else{ >> return WeightedGraph.DEFAULT_EDGE_WEIGHT; >> } >> } >> >> One common error would be something like: >> Edge e=graph.getEdge(i,j); //Edge (i,j) is not part of the graph, so >> e==null; >> cost += graph.getEdgeWeight(e); //Correct, does not invoke an exception >> >> >> At the very least, the javadoc for the getEdgeWeight function should >> mention the above pitfall by specify that invoking the getEdgeWeight >> function on null returns WeightedGraph.DEFAULT_EDGE_WEIGHT so it's the >> user's problem to check whether the edge is not equal to null. >> >> This is just a suggestion. If there is support for this change, I'll make >> a change request. >> >> br, >> >> Joris >> >> >> ------------------------------------------------------------------------------ >> Learn Graph Databases - Download FREE O'Reilly Book >> "Graph Databases" is the definitive new guide to graph databases and their >> applications. Written by three acclaimed leaders in the field, >> this first edition is now available. Download your free book today! >> http://p.sf.net/sfu/13534_NeoTech >> _______________________________________________ >> jgrapht-users mailing list >> jgr...@li... >> https://lists.sourceforge.net/lists/listinfo/jgrapht-users >> >> > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/13534_NeoTech > _______________________________________________ > jgrapht-users mailing list > jgr...@li... > https://lists.sourceforge.net/lists/listinfo/jgrapht-users > > -- Javier MV |
From: Georg H. <geo...@go...> - 2014-03-21 19:03:39
|
i strongly agree with your suggestion. i already had the problem by myself, but forgot to write a pull request afterwards .... It's quiet horrible to find bugs, if you dont know about the current behavior. On 21 March 2014 19:56, Joris Kinable <de...@gm...> wrote: > Dear, > > In the latest version of jgrapht (and perhaps also in other versions), the > getEdgeWeight(E e) function is implemented as follows: > > public double getEdgeWeight(E e) > { > if (e instanceof DefaultWeightedEdge) { > return ((DefaultWeightedEdge) e).getWeight(); > } else { > return WeightedGraph.DEFAULT_EDGE_WEIGHT; > } > } > > > If e==null, i.e. the edge does not exist, then this function will return > DEFAULT_EDGE_WEIGHT. This is strange as often invoking the getEdgeWeight > function on a non-existing edge is simply a bug. > > I would suggest to modify the above function to something like: > public double getEdgeWeight(E e) > { > if (e instanceof DefaultWeightedEdge) { > return ((DefaultWeightedEdge) e).getWeight(); > } else if(e==null){ > throw new UnsupportedArgumentException("Edge cannot be null"); > }else{ > return WeightedGraph.DEFAULT_EDGE_WEIGHT; > } > } > > One common error would be something like: > Edge e=graph.getEdge(i,j); //Edge (i,j) is not part of the graph, so > e==null; > cost += graph.getEdgeWeight(e); //Correct, does not invoke an exception > > > At the very least, the javadoc for the getEdgeWeight function should > mention the above pitfall by specify that invoking the getEdgeWeight > function on null returns WeightedGraph.DEFAULT_EDGE_WEIGHT so it's the > user's problem to check whether the edge is not equal to null. > > This is just a suggestion. If there is support for this change, I'll make > a change request. > > br, > > Joris > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/13534_NeoTech > _______________________________________________ > jgrapht-users mailing list > jgr...@li... > https://lists.sourceforge.net/lists/listinfo/jgrapht-users > > |
From: Joris K. <de...@gm...> - 2014-03-21 18:56:47
|
Dear, In the latest version of jgrapht (and perhaps also in other versions), the getEdgeWeight(E e) function is implemented as follows: public double getEdgeWeight(E e) { if (e instanceof DefaultWeightedEdge) { return ((DefaultWeightedEdge) e).getWeight(); } else { return WeightedGraph.DEFAULT_EDGE_WEIGHT; } } If e==null, i.e. the edge does not exist, then this function will return DEFAULT_EDGE_WEIGHT. This is strange as often invoking the getEdgeWeight function on a non-existing edge is simply a bug. I would suggest to modify the above function to something like: public double getEdgeWeight(E e) { if (e instanceof DefaultWeightedEdge) { return ((DefaultWeightedEdge) e).getWeight(); } else if(e==null){ throw new UnsupportedArgumentException("Edge cannot be null"); }else{ return WeightedGraph.DEFAULT_EDGE_WEIGHT; } } One common error would be something like: Edge e=graph.getEdge(i,j); //Edge (i,j) is not part of the graph, so e==null; cost += graph.getEdgeWeight(e); //Correct, does not invoke an exception At the very least, the javadoc for the getEdgeWeight function should mention the above pitfall by specify that invoking the getEdgeWeight function on null returns WeightedGraph.DEFAULT_EDGE_WEIGHT so it's the user's problem to check whether the edge is not equal to null. This is just a suggestion. If there is support for this change, I'll make a change request. br, Joris |
From: Joris K. <de...@gm...> - 2014-03-19 21:29:22
|
You are creating a self-loop which is not allowed in the type of graph you are using. This means that you are adding a directed edge from a vertex to itself. From the looks of it, your error is in this loop: for (String person : people) { graph.addVertex(person); graph.addEdge(people.get(0), person, new RelationshipEdge<String>(people.get(0), person, friend)); } You are iterating over all the persons in the list people. This list includes John. In the same loop you are also adding edges from John (people.get(0)) to all persons in the list people. As a conclusion you are adding a loop from John to itself. Simple solution: for(String person: people){ graph.addVertex(person); if(person != john){ graph.addEdge(... ); } } br, Joris On Sat, Mar 15, 2014 at 11:18 AM, Patricia_Sim <pt...@gm...> wrote: > Hi Everybody > > I'm trying to create directed graph with label edge by jgrapht. I learn how > to create by "LabeledEdges" example which source code shown below > > public class LabeledEdges { > private static final String friend = "friend"; > private static final String enemy = "enemy"; > > public static void main(String[] args) { > DirectedGraph<String, RelationshipEdge> graph = > new DirectedMultigraph<String, RelationshipEdge>( > new ClassBasedEdgeFactory<String, > RelationshipEdge>(RelationshipEdge.class)); > > ArrayList<String> people = new ArrayList<String>(); > people.add("John"); > people.add("James"); > people.add("Sarah"); > people.add("Jessica"); > > // John is everyone's friend > for (String person : people) { > graph.addVertex(person); > graph.addEdge(people.get(0), person, new > RelationshipEdge<String>(people.get(0), person, friend)); > } > > // Apparently James doesn't really like John > graph.addEdge("James", "John", new > RelationshipEdge<String>("James", > "John", enemy)); > > // Jessica is Sarah and James's friend > graph.addEdge("Jessica", "Sarah", new > RelationshipEdge<String>("Jessica", "Sarah", friend)); > graph.addEdge("Jessica", "James", new > RelationshipEdge<String>("Jessica", "James", friend)); > > // But Sarah doesn't really like James > graph.addEdge("Sarah", "James", new > RelationshipEdge<String>("Sarah", "James", enemy)); > > for (RelationshipEdge edge : graph.edgeSet()) { > if (edge.toString().equals("enemy")) { > System.out.printf(edge.getV1()+"is an enemy of "+ > edge.getV2()+"\n"); > } else if (edge.toString().equals("friend")) { > System.out.printf( edge.getV1()+" is a friend of "+ > edge.getV2()+"\n"); > } > } > } > > public static class RelationshipEdge<V> extends DefaultEdge { > private V v1; > private V v2; > private String label; > > public RelationshipEdge(V v1, V v2, String label) { > this.v1 = v1; > this.v2 = v2; > this.label = label; > } > > public V getV1() { > return v1; > } > > public V getV2() { > return v2; > } > > public String toString() { > return label; > } > } > > However, when I run this example, it show the error message > "Exception in thread "main" java.lang.IllegalArgumentException: > loops not allowed > at > org.jgrapht.graph.AbstractBaseGraph.addEdge(AbstractBaseGraph.java:243)" > > How can I do to run this example > > > > -- > View this message in context: > http://jgrapht-users.107614.n3.nabble.com/Label-Edge-Example-tp4024899.html > Sent from the jgrapht-users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/13534_NeoTech > _______________________________________________ > jgrapht-users mailing list > jgr...@li... > https://lists.sourceforge.net/lists/listinfo/jgrapht-users > |
From: Szabolcs B. <bes...@gm...> - 2014-03-19 21:29:18
|
Hi! The problem here is that DirectedMultigraph doest not allow loops and in your first loop you are trying to do > graph.addEdge(people.get(0), person, new > RelationshipEdge<String>(people.get(0), person, friend)); > which translates to > graph.addEdge("John", "John", new RelationshipEdge<String>("John", "John", > friend)); on the first iteration. > Your option here is to either use a DefaultDirectedGraph (a non-simple directed graph in which multiple edges between any two vertices are *not*permitted, but loops are) or rewrite your code so that it does not try to friend John with "himself". 2014-03-15 16:18 GMT+01:00 Patricia_Sim <pt...@gm...>: > Hi Everybody > > I'm trying to create directed graph with label edge by jgrapht. I learn how > to create by "LabeledEdges" example which source code shown below > > public class LabeledEdges { > private static final String friend = "friend"; > private static final String enemy = "enemy"; > > public static void main(String[] args) { > DirectedGraph<String, RelationshipEdge> graph = > new DirectedMultigraph<String, RelationshipEdge>( > new ClassBasedEdgeFactory<String, > RelationshipEdge>(RelationshipEdge.class)); > > ArrayList<String> people = new ArrayList<String>(); > people.add("John"); > people.add("James"); > people.add("Sarah"); > people.add("Jessica"); > > // John is everyone's friend > for (String person : people) { > graph.addVertex(person); > graph.addEdge(people.get(0), person, new > RelationshipEdge<String>(people.get(0), person, friend)); > } > > // Apparently James doesn't really like John > graph.addEdge("James", "John", new > RelationshipEdge<String>("James", > "John", enemy)); > > // Jessica is Sarah and James's friend > graph.addEdge("Jessica", "Sarah", new > RelationshipEdge<String>("Jessica", "Sarah", friend)); > graph.addEdge("Jessica", "James", new > RelationshipEdge<String>("Jessica", "James", friend)); > > // But Sarah doesn't really like James > graph.addEdge("Sarah", "James", new > RelationshipEdge<String>("Sarah", "James", enemy)); > > for (RelationshipEdge edge : graph.edgeSet()) { > if (edge.toString().equals("enemy")) { > System.out.printf(edge.getV1()+"is an enemy of "+ > edge.getV2()+"\n"); > } else if (edge.toString().equals("friend")) { > System.out.printf( edge.getV1()+" is a friend of "+ > edge.getV2()+"\n"); > } > } > } > > public static class RelationshipEdge<V> extends DefaultEdge { > private V v1; > private V v2; > private String label; > > public RelationshipEdge(V v1, V v2, String label) { > this.v1 = v1; > this.v2 = v2; > this.label = label; > } > > public V getV1() { > return v1; > } > > public V getV2() { > return v2; > } > > public String toString() { > return label; > } > } > > However, when I run this example, it show the error message > "Exception in thread "main" java.lang.IllegalArgumentException: > loops not allowed > at > org.jgrapht.graph.AbstractBaseGraph.addEdge(AbstractBaseGraph.java:243)" > > How can I do to run this example > > > > -- > View this message in context: > http://jgrapht-users.107614.n3.nabble.com/Label-Edge-Example-tp4024899.html > Sent from the jgrapht-users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/13534_NeoTech > _______________________________________________ > jgrapht-users mailing list > jgr...@li... > https://lists.sourceforge.net/lists/listinfo/jgrapht-users > |
From: Patricia_Sim <pt...@gm...> - 2014-03-15 15:18:51
|
Hi Everybody I'm trying to create directed graph with label edge by jgrapht. I learn how to create by "LabeledEdges" example which source code shown below public class LabeledEdges { private static final String friend = "friend"; private static final String enemy = "enemy"; public static void main(String[] args) { DirectedGraph<String, RelationshipEdge> graph = new DirectedMultigraph<String, RelationshipEdge>( new ClassBasedEdgeFactory<String, RelationshipEdge>(RelationshipEdge.class)); ArrayList<String> people = new ArrayList<String>(); people.add("John"); people.add("James"); people.add("Sarah"); people.add("Jessica"); // John is everyone's friend for (String person : people) { graph.addVertex(person); graph.addEdge(people.get(0), person, new RelationshipEdge<String>(people.get(0), person, friend)); } // Apparently James doesn't really like John graph.addEdge("James", "John", new RelationshipEdge<String>("James", "John", enemy)); // Jessica is Sarah and James's friend graph.addEdge("Jessica", "Sarah", new RelationshipEdge<String>("Jessica", "Sarah", friend)); graph.addEdge("Jessica", "James", new RelationshipEdge<String>("Jessica", "James", friend)); // But Sarah doesn't really like James graph.addEdge("Sarah", "James", new RelationshipEdge<String>("Sarah", "James", enemy)); for (RelationshipEdge edge : graph.edgeSet()) { if (edge.toString().equals("enemy")) { System.out.printf(edge.getV1()+"is an enemy of "+ edge.getV2()+"\n"); } else if (edge.toString().equals("friend")) { System.out.printf( edge.getV1()+" is a friend of "+ edge.getV2()+"\n"); } } } public static class RelationshipEdge<V> extends DefaultEdge { private V v1; private V v2; private String label; public RelationshipEdge(V v1, V v2, String label) { this.v1 = v1; this.v2 = v2; this.label = label; } public V getV1() { return v1; } public V getV2() { return v2; } public String toString() { return label; } } However, when I run this example, it show the error message "Exception in thread "main" java.lang.IllegalArgumentException: loops not allowed at org.jgrapht.graph.AbstractBaseGraph.addEdge(AbstractBaseGraph.java:243)" How can I do to run this example -- View this message in context: http://jgrapht-users.107614.n3.nabble.com/Label-Edge-Example-tp4024899.html Sent from the jgrapht-users mailing list archive at Nabble.com. |
From: H.N. de R. <hnr...@gr...> - 2014-02-15 15:00:48
|
On Sat, Feb 15, 2014 at 07:05:16AM -0600, Haluk Dogan wrote: > Say I have a directed graph. I actually want to convert it to Bayesian > Network which requires DAG. Even though, removing edges breaks the > dependency relation of nodes, it is OK for this phase of my analysis. I'll > do the same with Spirtes method later on. > > Adding, removing, reorienting edges are fine. But I can not remove vertices. So minimality is not required? A useful heuristic when creating a DAG for drawing is reversing back edges in a DFS traversal, see for example the description of the GraphViz algorithm. It's easy to implement and quick, you might try how to performs for your application. Another idea is using one of the algorithms in org.jgrapht.alg.cycle to collect all cycles and remove an edge from each one. Regards, Ernst -- Information System on Graph Classes and their Inclusions (ISGCI) http://www.graphclasses.org |
From: Haluk D. <hlk...@gm...> - 2014-02-15 13:05:23
|
Say I have a directed graph. I actually want to convert it to Bayesian Network which requires DAG. Even though, removing edges breaks the dependency relation of nodes, it is OK for this phase of my analysis. I'll do the same with Spirtes method later on. Adding, removing, reorienting edges are fine. But I can not remove vertices. Thanks. On Sat, Feb 15, 2014 at 3:45 AM, H.N. de Ridder <hnr...@gr...>wrote: > On Fri, Feb 14, 2014 at 03:43:24PM -0600, Haluk Dogan wrote: > > > I want to convert my directed graph to directed acyclic graph. I know > > Feedback Vertex Set algorithm can do this. However, I couldn't see its > > method in jGrapht. > > Can you describe more precisely what you mean by 'convert' and for which > purpose? Add edges? Remove edges? Reorient them? Remove vertices? > Any minimality constraints? > > Regards, > Ernst > > -- > Information System on Graph Classes and their Inclusions (ISGCI) > http://www.graphclasses.org > > > ------------------------------------------------------------------------------ > Android apps run on BlackBerry 10 > Introducing the new BlackBerry 10.2.1 Runtime for Android apps. > Now with support for Jelly Bean, Bluetooth, Mapview and more. > Get your Android app in front of a whole new audience. Start now. > > http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk > _______________________________________________ > jgrapht-users mailing list > jgr...@li... > https://lists.sourceforge.net/lists/listinfo/jgrapht-users > -- HD |
From: H.N. de R. <hnr...@gr...> - 2014-02-15 10:01:39
|
On Fri, Feb 14, 2014 at 03:43:24PM -0600, Haluk Dogan wrote: > I want to convert my directed graph to directed acyclic graph. I know > Feedback Vertex Set algorithm can do this. However, I couldn't see its > method in jGrapht. Can you describe more precisely what you mean by 'convert' and for which purpose? Add edges? Remove edges? Reorient them? Remove vertices? Any minimality constraints? Regards, Ernst -- Information System on Graph Classes and their Inclusions (ISGCI) http://www.graphclasses.org |
From: Haluk D. <hlk...@gm...> - 2014-02-14 21:43:30
|
Hi, I want to convert my directed graph to directed acyclic graph. I know Feedback Vertex Set algorithm can do this. However, I couldn't see its method in jGrapht. Is there any other way to do this by using jGrapht? Thanks. -- HD |
From: John S. <js...@gm...> - 2014-02-10 00:49:53
|
Someone contributed a full grid generator a while back: https://github.com/jgrapht/jgrapht/blob/master/jgrapht-core/src/main/java/org/jgrapht/generate/GridGraphGenerator.java https://github.com/jgrapht/jgrapht/blob/master/jgrapht-core/src/test/java/org/jgrapht/generate/GraphGeneratorTest.java You could start with the code for that and adapt it to your needs. On Thu, Feb 6, 2014 at 11:01 AM, Liora Braunstain <lio...@gm...> wrote: > Hello all, > > I am looking for a way to create a random grid graph and perform simulations > on it. > Basically the grid will be in the first quarter (positive x's and positive > y's), > when each iteration it is blocked by some x+y=m line. > > I would like to generate random graphs, when each realization depends on the > current line (as some nodes will be "above" the line and so unreachable). > Edges between nodes can go only upward or to the right. > > After going over the javadoc , i am still not sure if it is possible to > create a random grid graph, > And as i cannot find VertexFactory examples, if it will be possible to > restrict the creation of the edges. > > Thank you very much! > > ------------------------------------------------------------------------------ > Managing the Performance of Cloud-Based Applications > Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. > Read the Whitepaper. > http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk > _______________________________________________ > jgrapht-users mailing list > jgr...@li... > https://lists.sourceforge.net/lists/listinfo/jgrapht-users > |
From: Liora B. <lio...@gm...> - 2014-02-06 19:01:15
|
Hello all, I am looking for a way to create a random grid graph and perform simulations on it. Basically the grid will be in the first quarter (positive x's and positive y's), when each iteration it is blocked by some x+y=m line. I would like to generate random graphs, when each realization depends on the current line (as some nodes will be "above" the line and so unreachable). Edges between nodes can go only upward or to the right. After going over the javadoc , i am still not sure if it is possible to create a random grid graph, And as i cannot find VertexFactory examples, if it will be possible to restrict the creation of the edges. Thank you very much! |
From: Badoo <nor...@ba...> - 2014-01-11 22:19:48
|
Leggi tutti i messaggi da Alex prima che questi siano eliminati! Per leggere il tuo messaggio, segui questo link: http://eu1.badoo.com/0324183337/in/KOYV1ovENrg/?lang_id=8&g=57-0-4&m=65&mid=52d1c37d000000000008000002e2307d01ade0ce00c0 Se cliccando sul link, questo non dovesse funzionare, copialo nella barra degli indirizzi del tuo browser. Questa comunicazione fa parte del sistema di notifica per il messaggio inviatoti da Alex. Se pensi che si tratti di un errore, ignora questa comunicazione. Buon divertimento! Dal team di Badoo Questa e-mail ti è stata inviata da Badoo Trading Limited (indirizzo postale indicato in basso).Se non desideri ricevere altri messaggi da parte di Badoo, clicca qui: https://eu1.badoo.com/impersonation.phtml?lang_id=8&email=jgrapht-users%40lists.sourceforge.net&block_code=5bdfba&m=65&mid=52d1c37d000000000008000002e2307d01ade0ce00c0&g=0-0-4. Badoo Trading Limited è una società a responsabilità limitata registrata in Inghilterra e Galles con il numero d'impresa 7540255 con sede legale all'indirizzo Media Village, 131 - 151 Great Titchfield Street, London, W1W 5BB. |
From: Badoo <nor...@ba...> - 2014-01-03 22:16:19
|
Alex ti ha inviato un messaggio... Il mittente di questo messaggio e il suo contenuto saranno visibili solo a te. Per scoprire che cosa c'è scritto nel messaggio e per rispondere subito, segui questo link: http://eu1.badoo.com/0324183337/in/KOYV1ovENrg/?lang_id=8&g=57-0-4&m=21&mid=52c736aa000000000008000002d7a3aa0030ed7c002c Se il link qui sopra non dovesse funzionare, prova a copiarlo e incollarlo nella barra degli indirizzi del tuo browser. Questa comunicazione fa parte del sistema di notifica per il messaggio inviato da Alex. Se pensi che si tratti di un errore, ignora questa comunicazione e il messaggio verrà cancellato automaticamente dal nostro sistema. Buon divertimento! Il team di Badoo Questa e-mail ti è stata inviata da Badoo Trading Limited (indirizzo postale indicato in basso).Se non desideri ricevere altri messaggi da parte di Badoo, clicca qui: https://eu1.badoo.com/impersonation.phtml?lang_id=8&email=jgrapht-users%40lists.sourceforge.net&block_code=5bdfba&m=21&mid=52c736aa000000000008000002d7a3aa0030ed7c002c&g=0-0-4. Badoo Trading Limited è una società a responsabilità limitata registrata in Inghilterra e Galles con il numero d'impresa 7540255 con sede legale all'indirizzo Media Village, 131 - 151 Great Titchfield Street, London, W1W 5BB. |
From: <org...@io...> - 2013-12-31 17:00:46
|
On Tue, 31 Dec 2013 17:05:50 +0100 "H.N. de Ridder" <hnr...@gr...> wrote: > Hi, > > no, the ConnectivityInspector ignores the direction of the edges. So if your graph has edges s->t->u and you call connectedSetOf(t), you will get {s, t, u} as the result. If you want to get precisely those nodes that are reachable from t (traversing edges in the "proper" direction only), you can do a breadth first search from t with BreadthFirstInspector. Yes, makes sense. Someone recommended DepthFirstInspector off-list, so I attempted that first (there are a few other properties of the depth first search that I can make use of in the implementation). > > If you want to do this for many nodes, it may be faster to first calculate the transitive closure of the graph and then check the out-neighbours of your node. The transitive closure G' of G has an edge u->v precisely when there is a path u==>v in G. Right. > > Do you have a unique top level term from which all useful terms are reachable, or is your construction more complicated? The top level term is chosen manually at compile-time in much the same way that the top-level term is chosen at run-time in Java. Thanks! M |