本文整理汇总了Python中sage.graphs.graph.Graph.average_degree方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.average_degree方法的具体用法?Python Graph.average_degree怎么用?Python Graph.average_degree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.graphs.graph.Graph
的用法示例。
在下文中一共展示了Graph.average_degree方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: average_degree
# 需要导入模块: from sage.graphs.graph import Graph [as 别名]
# 或者: from sage.graphs.graph.Graph import average_degree [as 别名]
def average_degree(self, *largs, **kargs):
store = lookup(kargs, "store", default = discretezoo.WRITE_TO_DB,
destroy = True)
cur = lookup(kargs, "cur", default = None, destroy = True)
default = len(largs) + len(kargs) == 0
try:
if not default:
raise NotImplementedError
lookup(self._graphprops, "average_degree")
return 2*self.size(store = store,
cur = cur)/self.order(store = store, cur = cur)
except (KeyError, NotImplementedError):
a = Graph.average_degree(self, *largs, **kargs)
if default:
if store:
self._update_rows(ZooGraph, {"average_degree": a},
{self._spec["primary_key"]: self._zooid},
cur = cur)
update(self._graphprops, "average_degree", a)
return a