# create some non-isomorphic graphs
g1 <- graph.isocreate(3, 10)
g2 <- graph.isocreate(3, 11)
graph.isoclass(g1)
graph.isomorphic(g1, g2)
# create two isomorphic graphs, by
# permuting the vertices of the first
g1 <- barabasi.game(30, m=2, directed=FALSE)
el <- get.edgelist(g1)
iso <- sample(vcount(g1))-1
el <- matrix(iso[ el+1 ], nc=2)
g2 <- graph(t(el), directed=FALSE)
graph.isomorphic.vf2(g1, g2)
Run the code above in your browser using DataCamp Workspace