本文整理汇总了Python中sage.graphs.digraph.DiGraph.__eq__方法的典型用法代码示例。如果您正苦于以下问题:Python DiGraph.__eq__方法的具体用法?Python DiGraph.__eq__怎么用?Python DiGraph.__eq__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.graphs.digraph.DiGraph
的用法示例。
在下文中一共展示了DiGraph.__eq__方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __eq__
# 需要导入模块: from sage.graphs.digraph import DiGraph [as 别名]
# 或者: from sage.graphs.digraph.DiGraph import __eq__ [as 别名]
def __eq__(self, other):
"""
Compare self and other for equality.
Kontsevich graphs are considered equal if the underlying DiGraphs
differ only in their internal vertex labeling.
"""
assert self.internal_vertices_normalized(), \
"Internal vertices should be normalized."
if not isinstance(other, KontsevichGraph):
return False
if len(self) != len(other): return False
if len(self.internal_vertices()) != len(other.internal_vertices()):
return False
for KG in other.internal_vertex_relabelings():
if DiGraph.__eq__(self, KG):
return True
return False