本文整理汇总了Python中Graph.directed方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.directed方法的具体用法?Python Graph.directed怎么用?Python Graph.directed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graph
的用法示例。
在下文中一共展示了Graph.directed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Create
# 需要导入模块: import Graph [as 别名]
# 或者: from Graph import directed [as 别名]
def Create(self, theGraphEditor):
theGraphEditor.config(cursor="watch")
dial = Dialog(theGraphEditor, 1, 1, "Create Random Planar Graph")
if dial.result is None:
theGraphEditor.config(cursor="")
return
n=dial.result[0]
if n<=1: return
m=dial.result[1]
direction=dial.result[2]
layout=dial.result[3]
G=Graph()
G.directed=direction
for v in range(0,n):
G.AddVertex()
Edges=MaximalPlanarEdges(G,n,direction)
for i in range(0,m):
pos=random.randint(0,len(Edges)-1)
G.AddEdge(Edges[pos][0],Edges[pos][1], initialize_weight=False)
del Edges[pos]
if layout==0:
if RandomCoords(G):
DrawNewGraph(theGraphEditor,G,direction)
elif layout==1:
if CircularCoords(G):
DrawNewGraph(theGraphEditor,G,direction)
elif layout==2:
if FPP_PlanarCoords(G):
DrawNewGraph(theGraphEditor,G,direction)
else:
if Schnyder_PlanarCoords(G):
DrawNewGraph(theGraphEditor,G,direction)
theGraphEditor.config(cursor="")