1 2context("graph.subisomorphic.vf2") 3 4test_that("graph.subisomorphic.vf2 works", { 5 6 library(igraph) 7 set.seed(42) 8 9 g1 <- sample_gnp(20,6/20) 10 g2 <- sample_gnp(20,6/20) 11 g <- g1 %du% g2 12 13 ig1 <- graph.subisomorphic.vf2(g, g1) 14 ig2 <- graph.subisomorphic.vf2(g, g2) 15 16 expect_true(ig1$iso) 17 expect_that(ig1$map12, equals(c(1:vcount(g1), rep(0, vcount(g2))))) 18 expect_that(ig1$map21, equals(1:vcount(g1))) 19 20 expect_true(ig2$iso) 21 expect_that(ig2$map12, equals(c(rep(0, vcount(g1)), 1:vcount(g2)))) 22 expect_that(ig2$map21, equals(1:vcount(g2) + vcount(g1))) 23 24}) 25