cassovary
cassovary copied to clipboard
Undirected Graph Support in Cassovary
Related to https://github.com/twitter/cassovary/issues/140
The idea of this wrapper is that each graph implementation shouldn't need custom code for StoredGraphDir.Mutual
. We can write a single wrapper which works with any graph implementation.
Here is an initial undirected graph class. If this looks good, I can add a test and support for mutable undirected graphs to this pull request.
@pankajgupta
@szymonm : I was also just thinking that, and agree that parametrizing Graph with NodeType will be better. Let's do that in a separate PR. See my comment above, we can do getNodeById to return UndirectedNode in UndirectedGraph regardless.
On the other hand, I used: https://github.com/scala-graph/scala-graph.
They use:
trait GraphLike[
N,
E[X] <: EdgeLikeIn[X],
+This[X, Y[X]<:EdgeLikeIn[X]] <: GraphLike[X,Y,This] with AnySet[Param[X,Y]] with Graph[X,Y]
]
and IMO this type magic makes the library very hard to use...
So let's be carefull about that.
:) Agreed that there's a balance. Parametrizing by NodeType is good I think.
(Sorry for the delay). I changed UndirectedGraph to a trait, made UndirectedNode a sub-trait of UnidirectedNode, and made UndirectedGraph's methods return UndirectedNode. I think that addresses all of your comments. I also just rebased from master.
Ouch, somehow I missed your updated commits, Peter! Also, looks your rebase has gone awry as the diff in this PR is showing other changes unrelated to your change. May I ask you to build a new patch or create a clean one on top of current master. Thanks.
Ping @plofgren
To be honest, I don't think I'll get back to this until at least after I finish my PhD in a couple months. It doesn't really add functionality, so I propose we just drop it and optionally change the documentation as suggested in #140.
Ah, you have done a lot of work. Let's leave this open for now and hope you come back to it when you get time. Or someone else might pick it up too.
Sounds good.
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 4 committers have signed the CLA.
:x: Pankaj Gupta
:x: plofgren
:x: szymonm
:x: pankajgupta
Pankaj Gupta seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.