使用 R 中的 igraph 计算两个节点之间的公共节点

Counting common nodes between two nodes with igraph in R

假设我生成了一个无向图(你可以想想我在facebook上的朋友的图)。我想知道,对于每对节点(带两个朋友),他们拥有的共同 "nodes" 数量(其中 "mutual friends")。 igraph 中有我可以使用的函数吗?

或者在网络或 sna 包中?

谢谢。

如果v_1和v_2是图g中的两个节点,那么:

cocitation(g, v_1)[v_2]

会给你他们拥有的 "mutual friends" 的数量。 明明是一样的

cocitation(g, v_2)[v_1]