I'm doing the subgraph isomorphism using igraph library in R.
I have two graphs p1
and p2
:
p1 =graph.formula("1"--+"2")
V(p1)$color = c(1,2)
E(p1)$color = c(2)
p2 =graph.formula("a"--+"b"--+"c")
V(p2)$color=c(1,1, 2)
E(p2)$color=c(2,2)
I got the result when applying graph.subisomorphic:
result1 = graph.subisomorphic.vf2(p2,p1)
result1
$iso [1] TRUE
$map12 [1] 0 1 2
$map21 [1] 2 3
I can understand this result which contains two mappings.
However, I want to get all the subisomorphisms, so I applied another function called graph.get.subisomorphism. According to R documentation, the result is a list of named numeric vectors:
"graph.get.subisomorphisms.vf2 returns a list of numeric vectors, each numeric vector is an isomorphic mapping from graph2 to a subgraph of graph1."
> result2 = graph.get.subisomorphisms.vf2(p2,p1)
result2
[[1]]
2 < NA >
2 3
Could anyone help me explain the result? Why there is a < NA >
as the name of the numeric vector?