我感兴趣的是生成带节点约束的加权有向随机图。在R或Python中是否有可自定义的图形生成器?我所知道的唯一一个是it的erdos.renyi.game(),但我不确定是否可以自定义它。
编辑:我想要做的定制是: 1)绘制一个加权图;2)约束一些节点从绘制边。
发布于 2017-07-04 18:18:17
在igraph中,您可以使用链接 Erdos_Renyi类。
为了约束某些节点绘制边,这是由p值控制的。
Erdos_Renyi(n, p, m, directed=False, loops=False) #these are the defaults示例:
from igraph import *
g = Graph.Erdos_Renyi(10,0.1,directed=True)
plot(g)通过设置p=0.1,您可以看到一些节点没有边缘。
对于重量,你可以做如下的事情:
g.ecount() # to find the number of edges
g.es["weights"] = range(1, g.ecount())
g.es["label"] = weights
plot(g)结果:

https://stackoverflow.com/questions/44888529
复制相似问题