本文整理汇总了Python中sage.graphs.graph.Graph.edge_iterator方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.edge_iterator方法的具体用法?Python Graph.edge_iterator怎么用?Python Graph.edge_iterator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.graphs.graph.Graph
的用法示例。
在下文中一共展示了Graph.edge_iterator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sage.graphs.graph import Graph [as 别名]
# 或者: from sage.graphs.graph.Graph import edge_iterator [as 别名]
def __init__(self, G, names):
"""
Initialize ``self``.
TESTS::
sage: G = RightAngledArtinGroup(graphs.CycleGraph(5))
sage: TestSuite(G).run()
"""
self._graph = G
F = FreeGroup(names=names)
CG = Graph(G).complement() # Make sure it's mutable
CG.relabel() # Standardize the labels
cm = [[-1]*CG.num_verts() for _ in range(CG.num_verts())]
for i in range(CG.num_verts()):
cm[i][i] = 1
for u,v in CG.edge_iterator(labels=False):
cm[u][v] = 2
cm[v][u] = 2
self._coxeter_group = CoxeterGroup(CoxeterMatrix(cm, index_set=G.vertices()))
rels = tuple(F([i + 1, j + 1, -i - 1, -j - 1])
for i, j in CG.edge_iterator(labels=False)) # +/- 1 for indexing
FinitelyPresentedGroup.__init__(self, F, rels)