本文整理汇总了Python中sage.graphs.digraph.DiGraph.outgoing_edges方法的典型用法代码示例。如果您正苦于以下问题:Python DiGraph.outgoing_edges方法的具体用法?Python DiGraph.outgoing_edges怎么用?Python DiGraph.outgoing_edges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.graphs.digraph.DiGraph
的用法示例。
在下文中一共展示了DiGraph.outgoing_edges方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: basis_of_simple_closed_curves
# 需要导入模块: from sage.graphs.digraph import DiGraph [as 别名]
# 或者: from sage.graphs.digraph.DiGraph import outgoing_edges [as 别名]
def basis_of_simple_closed_curves(self):
from sage.graphs.digraph import DiGraph
from sage.all import randint
n = self._origami.nb_squares()
C = self.chain_space()
G = DiGraph(multiedges=True,loops=True,implementation='c_graph')
for i in xrange(2*n):
G.add_edge(self._starts[i], self._ends[i], i)
waiting = [0]
gens = []
reps = [None] * G.num_verts()
reps[0] = C.zero()
while waiting:
x = waiting.pop(randint(0,len(waiting)-1))
for v0,v1,e in G.outgoing_edges(x):
if reps[v1] is not None:
gens.append(reps[v0] + C.gen(e) - reps[v1])
else:
reps[v1] = reps[v0] + C.gen(e)
waiting.append(v1)
return gens