How to mine for motifs in R with iGraph

前端 未结 2 485
无人共我
无人共我 2021-02-06 09:41

I\'m trying to mine for 3-node motifs in R using the package igraph. I would like to retrieve the number of motifs for each individual vertex in the graph, which d

2条回答
  •  不思量自难忘°
    2021-02-06 09:51

    Here is a quick how-to.

    It you are interested in the triads of vertex A, then first create the induced subgraph that contains A and its immediate neighbors. You can do this via neighborhood() and induced.subgraph() or simply with graph.neighborhood().

    Then find the motifs in this subgraph, but not with graph.motifs(), but rather with triad.census(), because that counts all possible triples, even a non-connected ones.

    Then remove A from this subgraph, and call triad.census() again. The difference of the two count vector will be exactly the motifs that include A.

提交回复
热议问题