-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
missing get_minimum_spanning_tree
and similar
#57
Comments
What do you mean by |
I mean in the docs. From the second one:
From the third:
And the first seems to look like the second, and never specifies if the arborescence is minimal over the provided edge weights. |
All of these methods will return you the arborescences, which of course have a minimal number of edges. I don't recall whether I implemented one for the weighted case, as I don't have ever needed one. Do you know any good algorithm that scales well? |
Sure; for starters, scipy implements The source code there has a reference implementation of Kruskal's algorithm (in a weighted setting). The other option (outside of networkX's many implementations, one of which is Boruvka's algorithm) is graphblas, which would be very fast if done on the matrix, directly, but I can only find a version of Prim's algorithm in a C++ template repo...nothing for |
Note that these are all essentially My use-case is typically finding MSTs in a metric closure, so Prim's algorithm runs faster (on dens graphs). |
Very impressive library so far. Just wanted to mention here, unless I'm misreading your API docs, that the Graph object doesn't have an implementation of Prim's or Kruskal's minimum/maximum spanning tree. This is the last thing keeping me on e.g.
scipy.sparse.csgraph
, and was the first thing I looked for here.Ideally, I would imagine a slightly more useful MST interface that e.g. defaults to the spanning tree for the whole graph, but could accept an array of node activation flags and an (optional) cost matrix to calculate the MST on that induced subgraph. This is part of a simple way to approximate the steiner tree on those nodes, for instance. If the user doesn't supply a cost matrix, then the metric closure would work (again, if desired...MST on the original graph weights is probably the default).
I did find these, but a number expressly say the tree is not minimal:
spanning_arborescence
spanning_arborescence_kruskal
random_spanning_arborescence_kruskal
(very nice! Wilson's algorithm? Is this a uniform-random sample over unweighted trees? Is the MST the mode for weighted edges, like it normally would be?The text was updated successfully, but these errors were encountered: