本文整理汇总了Python中Graph.add_regular_edges方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.add_regular_edges方法的具体用法?Python Graph.add_regular_edges怎么用?Python Graph.add_regular_edges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graph
的用法示例。
在下文中一共展示了Graph.add_regular_edges方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: something
# 需要导入模块: import Graph [as 别名]
# 或者: from Graph import add_regular_edges [as 别名]
def something():
n = 10
p = 1
# create n Vertices
n = int(n)
labels = string.ascii_lowercase + string.ascii_uppercase
vs = [Vertex(c) for c in labels[:n]]
# create a graph and a layout
# g = RandomGraph(vs, p)
g = Graph(vs, [])
g.add_regular_edges(4)
layout = CircleLayout(g)
# draw the graph
gw = GraphWorld()
gw.show_graph(g, layout)
gw.mainloop()
示例2: Graph
# 需要导入模块: import Graph [as 别名]
# 或者: from Graph import add_regular_edges [as 别名]
from Graph import *
from GraphWorld import *
vs = [Vertex(c) for c in "abcdefgh"]
g = Graph(vs)
g.add_regular_edges(6)
layout = CircleLayout(g)
# draw the graph
gw = GraphWorld()
gw.show_graph(g, layout)
gw.mainloop()