random_shell_graph#
- random_shell_graph(constructor, seed=None, *, create_using=None)[source]#
返回给定构造器的随机壳图(random shell graph)。
- 参数:
- constructor三元组列表
表示壳(shell)的参数,从中心壳开始。列表中的每个元素必须是
(n, m, d)
的形式,其中n
是该壳中的节点数,m
是该壳中的边数,d
是壳间(下一个)边与壳内边的比率。如果d
为零,则不会有壳内边;如果d
为一,则会有所有可能的壳内边。- seed整数、random_state 或 None(默认)
随机数生成状态的指示符。参见 随机性。
- create_using图构造器,可选(默认=nx.Graph)
要创建的图类型。不支持图实例。不支持多重图(Multigraph)和有向图(directed types),否则会引发
NetworkXError
。
示例
>>> constructor = [(10, 20, 0.8), (20, 40, 0.8)] >>> G = nx.random_shell_graph(constructor)