How to mine for motifs in R with iGraph

前端 未结 2 527
无人共我
无人共我 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:49

    Here's a self-contained example of Gabor's solution:

    testGraph = barabasi.game(10, 
        m = 5,
        power = 0.6, 
        out.pref = TRUE,
        zero.appeal = 0.5,
        directed = TRUE)
    
    # Label nodes to more easily keep track during subsets/deletions
    V(testGraph)$name = c('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
    
    subGraph = graph.neighborhood(testGraph, order = 1, V(testGraph)[1], mode = 'all')[[1]]
    allMotifs = triad.census(subGraph)
    removeNode = delete.vertices(subGraph, 'one')
    node1Motifs = allMotifs - triad.census(removeNode)
    

提交回复
热议问题