cyaron icon indicating copy to clipboard operation
cyaron copied to clipboard

图生成问题

Open ciao1 opened this issue 6 years ago • 5 comments

graph = Graph.graph(n, m, self_loop=False, repeated_edges=False),该方法貌似不能用weight_limit参数 我想生成一个无向的联通或非联通图,无环无重边,带权的

ciao1 avatar May 28 '19 11:05 ciao1

我看了源码,应该是可以生成的,但是为什么我代码运行后就是卡在后台一直运行,没有生成数据! 代码如下:graph=Graph.graph(v,e,self_loop=False, repeated_edges=False,weight_limit=(10,500)) 有没有哪位大神解释下?

ciao1 avatar May 31 '19 11:05 ciao1

提供的信息不够

但初步判断如果 e > v^2,而且又禁止了重边和自环,就会导致最后有一些边卡在那里生成不了。
这是我唯一想到的可能的情况,因为自己曾经遇到过。

YanWQ-monad avatar Jul 28 '19 14:07 YanWQ-monad

这是锅吧,让soha大佬修一下吧 @ soha jin

william-song-shy avatar Aug 03 '19 05:08 william-song-shy

是 @moesoha

william-song-shy avatar Aug 03 '19 06:08 william-song-shy

当 e > v(v-1)/2 时生成不了,因为点数为 v 的完全图边数为 v(v-1)/2 。 能不能发一下你的完整代码?

zhangjunyan2580 avatar Dec 21 '19 16:12 zhangjunyan2580