【问题标题】:output the names/ids list of node for subgraph (subisomorphisms)输出子图节点的名称/ID列表(子同构)
【发布时间】:2016-01-06 10:06:28
【问题描述】:

我想计算完整的 3 节点子图的数量。 原始图的节点具有名称。示例代码如下。

g <- graph.full(n=5, directed = TRUE)

# adjacency matrices 
d3<-matrix(c(0,1,1,1,0,1,1,1,0),nrow=3,ncol=3)

# Turn them into a convenient list
sbgDouble.mat<-list(d3)

# And then into a list of graph objects
sbgDouble.graph<-lapply(sbgDouble.mat, graph.adjacency)

# Count the number of the full 3-node subgraph

subgraph.freq.g<-c()

subgraph.freq.g[1]<-
graph.count.subisomorphisms.vf2(g, sbgDouble.graph[[1]])

#> subgraph.freq.g
# [1]  60

更新:我试过graph.get.isomorphisms.vf2(g, sbgDouble.graph[[1]]),但结果是list()

有人可以告诉我如何输出 3 节点子图的节点名称/ID 列表吗?谢谢。

【问题讨论】:

    标签: r igraph subgraph isomorphism


    【解决方案1】:

    为了查看顶点 ID,我们可以使用函数 graph.get.subisomorphisms.vf2(),例如,

    graph.get.subisomorphisms.vf2(g, sbgDouble.graph[[1]])[1]
    [[1]]
    + 3/5 vertices:
    [1] 1 2 3
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-02-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-29
      • 2021-07-16
      相关资源
      最近更新 更多