网络的平均聚类系数(igraph)
Average clustering coefficient of a network (igraph)
我想计算图的平均聚类系数(来自 igraph
包)。但是,我不确定应该遵循哪种方法。
library(igraph)
graph <- erdos.renyi.game(10000, 10000, type = "gnm")
# Global clustering coefficient
transitivity(graph)
# Average clustering coefficient
transitivity(graph, type = "average")
# The same as above
mean(transitivity(graph, type = "local"), na.rm = TRUE)
我将不胜感激。
使用transitivity(graph)
计算全局聚类系数(传递性):
This is simply the ratio of the triangles and the connected triples in
the graph. For directed graph the direction of the edges is ignored.
同时,transitivity(graph, type = "average")
是transitivity(graph, type = "local")
的平均值,首先计算局部聚类系数,然后取平均值:
The local transitivity of an undirected graph, this is calculated for
each vertex given in the vids argument. The local transitivity of a
vertex is the ratio of the triangles connected to the vertex and the
triples centered on the vertex. For directed graph the direction of
the edges is ignored.
参见,例如,?transitivity
和 Clustering coefficient。
所以首先它们都是有效的措施,选择应该取决于你的目的。它们之间的区别很明显(参见维基百科页面):
It is worth noting that this metric places more weight on the low
degree nodes, while the transitivity ratio places more weight on the
high degree nodes. In fact, a weighted average where each local
clustering score is weighted by k_i(k_i-1) is identical to the global clustering
coefficient
其中 k_i 是顶点 i 邻居的数量。因此,也许同时使用它们也很公平。
transitivity(g, type="local")
输出向量的顺序如何?
是否与以下顺序相同:
degree(g, mode="all")
度向量有索引但聚类系数没有
@Julius Vainora 回答了。对于那些试图为 type = "average" 做什么寻找答案的人的附加说明,因为 igraph 文档没有说明任何相关内容:
transitivity(graph, type = "average")
与
相同
transitivity(graph, type = "localaverage")
与
相同
transitivity(graph, type = "localaverageundirected")
与
相同
mean(transitivity(graph, type = "local"), na.rm = TRUE)
我想计算图的平均聚类系数(来自 igraph
包)。但是,我不确定应该遵循哪种方法。
library(igraph)
graph <- erdos.renyi.game(10000, 10000, type = "gnm")
# Global clustering coefficient
transitivity(graph)
# Average clustering coefficient
transitivity(graph, type = "average")
# The same as above
mean(transitivity(graph, type = "local"), na.rm = TRUE)
我将不胜感激。
使用transitivity(graph)
计算全局聚类系数(传递性):
This is simply the ratio of the triangles and the connected triples in the graph. For directed graph the direction of the edges is ignored.
同时,transitivity(graph, type = "average")
是transitivity(graph, type = "local")
的平均值,首先计算局部聚类系数,然后取平均值:
The local transitivity of an undirected graph, this is calculated for each vertex given in the vids argument. The local transitivity of a vertex is the ratio of the triangles connected to the vertex and the triples centered on the vertex. For directed graph the direction of the edges is ignored.
参见,例如,?transitivity
和 Clustering coefficient。
所以首先它们都是有效的措施,选择应该取决于你的目的。它们之间的区别很明显(参见维基百科页面):
It is worth noting that this metric places more weight on the low degree nodes, while the transitivity ratio places more weight on the high degree nodes. In fact, a weighted average where each local clustering score is weighted by k_i(k_i-1) is identical to the global clustering coefficient
其中 k_i 是顶点 i 邻居的数量。因此,也许同时使用它们也很公平。
transitivity(g, type="local")
输出向量的顺序如何? 是否与以下顺序相同:
degree(g, mode="all")
度向量有索引但聚类系数没有
@Julius Vainora 回答了。对于那些试图为 type = "average" 做什么寻找答案的人的附加说明,因为 igraph 文档没有说明任何相关内容:
transitivity(graph, type = "average")
与
相同transitivity(graph, type = "localaverage")
与
相同transitivity(graph, type = "localaverageundirected")
与
相同mean(transitivity(graph, type = "local"), na.rm = TRUE)