Re: [jgrapht-users] Mixed graphs
Brought to you by:
barak_naveh,
perfecthash
From: H.N. de R. <hnr...@gr...> - 2015-01-08 20:55:30
|
On Thu, Jan 08, 2015 at 12:41:41PM +0100, Matyas Krutsky wrote: Maybe it is possible to use a GraphUnion of a directed and an undirected graph? > Thank you for your response, but unfortunately this is not applicable for > me since I have to distinguish between cases where there are actually two > directed edges with opposite direction between two nodes and where there is > an undirected edge. I would have to keep track of undirected edges > somewhere and treat both directed edges which forms the undirected edge as > one when changing some property or removing the edge. This seems more > difficult and error-prone then creating a sort of "semidirected view" over > undirected graph as I suggested... > > 2015-01-08 12:26 GMT+01:00 Dimitris Mavroeidis <dma...@cs...>: > > > This is a more general answer and applies to any graph implementation. It > > is often used in situations such as the one you describe. > > > > You can use a directed graph and simply represent any undirected edge with > > two directed edges. So, if you have an undirected edge between node A and > > node B, you would create an edge from node A to node B and another from > > node B to node A. > > > > If you think of it, an undirected graph is a generalization of a directed > > graph containing both directions between nodes. > > > > Dimitris > > > > On 08/01/2015 11:50 πμ, krutor wrote: > > > >> Hi, I'm considering using JGraphT as general graphstore in my project, > >> but I > >> need to represent graph as Mixed graph > >> (http://mathworld.wolfram.com/MixedGraph.html) - using directed and > >> undirected edges together in one graph. Is there any way to simulate this > >> behaviour in JGraphT? > >> > >> The best I came up with yet, is to hide JGraphT behind my own interface, > >> use > >> custom edges with DIRECTED flag and undirected graph implementation > >> overriding methods behavior where needed. When using algorithms, it is > >> usually ok for me that graph is treated like undirected, so I will just > >> use > >> them with the underlying undirected graph... > >> > >> Cleaner implementation may be implementing my own > >> AbstractBaseGraph.Specifics, but that is impossible to do since Specifics > >> class is private. Is there any special reason for it to be private? > >> > >> Is there any better way to do it? Am I missing something important? > >> > >> Thanks for response > >> > >> > >> > >> > >> -- > >> View this message in context: http://jgrapht-users.107614. > >> n3.nabble.com/Mixed-graphs-tp4024952.html > >> Sent from the jgrapht-users mailing list archive at Nabble.com. > >> > >> ------------------------------------------------------------ > >> ------------------ > >> Dive into the World of Parallel Programming! The Go Parallel Website, > >> sponsored by Intel and developed in partnership with Slashdot Media, is > >> your > >> hub for all things parallel software development, from weekly thought > >> leadership blogs to news, videos, case studies, tutorials and more. Take a > >> look and join the conversation now. http://goparallel.sourceforge.net > >> _______________________________________________ > >> jgrapht-users mailing list > >> jgr...@li... > >> https://lists.sourceforge.net/lists/listinfo/jgrapht-users > >> > > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming! The Go Parallel Website, > sponsored by Intel and developed in partnership with Slashdot Media, is your > hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials and more. Take a > look and join the conversation now. http://goparallel.sourceforge.net > _______________________________________________ > jgrapht-users mailing list > jgr...@li... > https://lists.sourceforge.net/lists/listinfo/jgrapht-users -- Information System on Graph Classes and their Inclusions (ISGCI) http://www.graphclasses.org |