0

完全な 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 リストを出力する方法を教えてください。ありがとう。

4

1 に答える 1

0

頂点 ID を表示するには、関数 を使用できます。graph.get.subisomorphisms.vf2()たとえば、

graph.get.subisomorphisms.vf2(g, sbgDouble.graph[[1]])[1]
[[1]]
+ 3/5 vertices:
[1] 1 2 3
于 2016-06-08T04:12:23.930 に答える