全部最小生成树的实现 [英] All minimum spanning trees implementation

查看:427
本文介绍了全部最小生成树的实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找一个实现(我使用 networkx 库),将发现所有的最小生成树( MST)无向加权图的。

I've been looking for an implementation (I'm using networkx library.) that will find all the minimum spanning trees (MST) of an undirected weighted graph.

我只能找到的实现Kruskal算法和Prim算法两者都将只返回一个MST。

I can only find implementations for Kruskal's Algorithm and Prim's Algorithm both of which will only return a single MST.

我已经看到了解决这一问题的文件(如重新presenting所有最小生成树与应用程序进行计数和代),但我的头往往通过冥思苦想如何将其转化为code好歹爆炸。

I've seen papers that address this problem (such as Representing all minimum spanning trees with applications to counting and generation) but my head tends to explode someway through trying to think how to translate it to code.

其实我一直没能找到任何语言的实现!

In fact i've not been able to find an implementation in any language!

推荐答案

Rubys给出了一个很好的一般的答案。但是,编写有效的code生成图的所有生成树是一个挑战,一个野兽。

Rubys gives a good general answer. But writing efficient code to generate all spanning trees of a graph is a beast of a challenge.

半路此页面,在2003年左右十二月,你会发现一个CWEB实现Knuth的算法查找给定图的所有生成树。

Half way down this page, at around Dec 2003, you'll find an CWEB implementation of Knuth's algorithm that finds all spanning trees of a given graph.

这篇关于全部最小生成树的实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆