[英]Calculate average degree distribution
Does anyone know how we can calculate average degree distribution using python-igraph ? 有谁知道我们如何使用python-igraph计算平均度分布? I thought it might have a function to so but all I could find was degree_distribution which only returns nodes degree not the average. 我以为它可能具有某种功能,但我能找到的只有度数分布,它只返回节点度数而不是平均值。
Thanks 谢谢
You don't really need to have a separate function to calculate all sorts of summary statistics about the degree distribution; 您实际上并不需要一个单独的函数来计算关于度分布的各种汇总统计信息。 igraph provides a function to calculate the mean of any list of numbers (see igraph.mean
) and also another function to calculate the degree list so you only need to combine the two: igraph提供了一个函数来计算任何数字列表的均值(请参阅igraph.mean
),还提供了另一个函数来计算度数列表,因此您只需要将两者结合即可:
>>> from igraph import Graph, mean
>>> g = Graph.GRG(100, 0.2)
>>> mean(g.degree())
10.8
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.