# create some non-isomorphic graphs
g1 <- graph.isocreate(3, 10)
g2 <- graph.isocreate(3, 11)
graph.isoclass(g1)
graph.isoclass(g2)
graph.isomorphic(g1, g2)
# create two isomorphic graphs, by
# permuting the vertices of the first
g1 <- barabasi.game(30, m=2, directed=FALSE)
g2 <- permute.vertices(g1, sample(vcount(g1)))
# should be TRUE
graph.isomorphic(g1, g2)
graph.isomorphic.bliss(g1, g2)
graph.isomorphic.vf2(g1, g2)
# colored graph isomorphism
g1 <- graph.ring(10)
g2 <- graph.ring(10)
graph.isomorphic.vf2(g1, g2)
V(g1)$color <- rep(1:2, length=vcount(g1))
V(g2)$color <- rep(2:1, length=vcount(g2))
graph.count.isomorphisms.vf2(g1, g2)
graph.count.isomorphisms.vf2(g1, g2, vertex.color1=NULL,
vertex.color2=NULL)
V(g1)$name <- letters[1:vcount(g1)]
V(g2)$name <- LETTERS[1:vcount(g2)]
graph.get.isomorphisms.vf2(g1, g2)
V(g1)$color <- 1
V(g2)$color <- 2
graph.isomorphic.vf2(g1, g2)
graph.isomorphic.vf2(g2, g2, vertex.color1=NULL,
vertex.color2=NULL)
# The LAD example
pattern <- graph.formula(1:2:3:4:5,
1 - 2:5, 2 - 1:5:3, 3 - 2:4, 4 - 3:5, 5 - 4:2:1)
target <- graph.formula(1:2:3:4:5:6:7:8:9,
1 - 2:5:7, 2 - 1:5:3, 3 - 2:4, 4 - 3:5:6:8:9,
5 - 1:2:4:6:7, 6 - 7:5:4:9, 7 - 1:5:6,
8 - 4:9, 9 - 6:4:8)
domains <- list(`1` = c(1,3,9), `2` = c(5,6,7,8), `3` = c(2,4,6,7,8,9),
`4` = c(1,3,9), `5` = c(2,4,8,9))
graph.subisomorphic.lad(pattern, target, all.maps=TRUE)
graph.subisomorphic.lad(pattern, target, induced=TRUE, all.maps=TRUE)
graph.subisomorphic.lad(pattern, target, domains=domains, all.maps=TRUE)
# Directed LAD example
pattern <- graph.formula(1:2:3, 1 -+ 2:3)
uring <- graph.ring(10)
dring <- graph.ring(10, directed=TRUE)
graph.subisomorphic.lad(pattern, uring)
graph.subisomorphic.lad(pattern, dring)
Run the code above in your browser using DataLab