r - 网络的平均聚类系数(igraph)

标签 r igraph social-networking

我想计算图的平均聚类系数(来自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)计算全局聚类系数(transitivity):

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.

参见,例如,?传递性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 邻居的数量。因此,也许同时使用它们也是相当公平的。

关于r - 网络的平均聚类系数(igraph),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48853610/

相关文章:

r - X 轴标签未显示在 ggplot 的聚类树状图中

在 R 中重复 for 循环

python - 按相似关系过滤图像列表

r - 如何计算点之间的最近距离?

Python igraph : get all possible paths in a directed graph

jquery - 什么样的 jquery/css 脚本定位按钮 "fixed",但也对网页滚动使用react?

c++ - R:如何编写可中断的 C++ 函数,并恢复部分结果

r - 自动将 R Markdown 应用程序重定向到不同的链接

swift - Firebase - 制作您关注的人的帖子的主页(快速)

clojure - 将 OAuth2 与 Compojure 结合使用的多合一解决方案