考虑这个简单的例子
library(tidygraph)
mygraph <- igraph::sample_gnp(1000, 10/100)
igraph::transitivity(mygraph)
[1] 0.0991597
也就是说,igraph
返回整个网络的传递系数。如何使用tidygraph
重现此结果?我只看到传递系数的tidygraph::local_transitivity()
版本。
> mygraph %>%
+ as_tbl_graph()
# A tbl_graph: 1000 nodes and 49603 edges
#
# An undirected simple graph with 1 component
#
# Node Data: 1,000 x 0 (active)
#
# Edge Data: 49,603 x 2
from to
<int> <int>
1 1 4
2 3 4
3 3 5
# ? with 4.96e+04 more rows
谢谢!