gr <- graphCr("1 o-> 2 o-o 3 <- 4 -- 5 -o 6 <-> 7")
gr0 <- standardizeEdges(graphCr("1 o-> 2 o-o 3 <- 4 -- 5 -o 6 <-> 7"))
gr21a <- standardizeEdges(graphCr("1 <-> 2 o-o 3 <- 4 -- 5 -o 6 <-> 7"))
gr32a <- standardizeEdges(graphCr("1 o-> 2 <-o 3 <- 4 -- 5 -o 6 <-> 7"))
gr23a <- standardizeEdges(graphCr("1 o-> 2 o-> 3 <- 4 -- 5 -o 6 <-> 7"))
gr34a <- standardizeEdges(graphCr("1 o-> 2 o-o 3 <-> 4 -- 5 -o 6 <-> 7"))
gr45a <- standardizeEdges(graphCr("1 o-> 2 o-o 3 <- 4 -> 5 -o 6 <-> 7"))
gr54a <- standardizeEdges(graphCr("1 o-> 2 o-o 3 <- 4 <- 5 -o 6 <-> 7"))
gr56a <- standardizeEdges(graphCr("1 o-> 2 o-o 3 <- 4 -- 5 -> 6 <-> 7"))
gr65a <- standardizeEdges(graphCr("1 o-> 2 o-o 3 <- 4 -- 5 <-o 6 <-> 7"))
test_that("arrow head transform works", {
expect_equal(standardizeEdges(chgEnds(gr, 1L, 2L)), gr0)
expect_equal(standardizeEdges(chgEnds(gr, 2L, 1L)), gr21a)
expect_equal(standardizeEdges(chgEnds(gr, 2L, 3L)), gr23a)
expect_equal(standardizeEdges(chgEnds(gr, 3L, 2L)), gr32a)
expect_equal(standardizeEdges(chgEnds(gr, 3L, 4L)), gr34a)
expect_equal(standardizeEdges(chgEnds(gr, 4L, 3L)), gr0)
expect_equal(standardizeEdges(chgEnds(gr, 4L, 5L)), gr45a)
expect_equal(standardizeEdges(chgEnds(gr, 5L, 4L)), gr54a)
expect_equal(standardizeEdges(chgEnds(gr, 6L, 5L)), gr65a)
expect_equal(standardizeEdges(chgEnds(gr, 5L, 6L)), gr56a)
expect_equal(standardizeEdges(chgEnds(gr, 6L, 7L)), gr0)
expect_equal(standardizeEdges(chgEnds(gr, 7L, 6L)), gr0)
expect_equal(standardizeEdges(chgEnds(gr, 5L, 1L)), gr0)
})
gr21t <- standardizeEdges(graphCr("1 -> 2 o-o 3 <- 4 -- 5 -o 6 <-> 7"))
gr12t <- standardizeEdges(graphCr("1 o- 2 o-o 3 <- 4 -- 5 -o 6 <-> 7"))
gr32t <- standardizeEdges(graphCr("1 o-> 2 -o 3 <- 4 -- 5 -o 6 <-> 7"))
gr23t <- standardizeEdges(graphCr("1 o-> 2 o- 3 <- 4 -- 5 -o 6 <-> 7"))
gr43t <- standardizeEdges(graphCr("1 o-> 2 o-o 3 -- 4 -- 5 -o 6 <-> 7"))
gr56t <- standardizeEdges(graphCr("1 o-> 2 o-o 3 <- 4 -- 5 -- 6 <-> 7"))
gr67t <- standardizeEdges(graphCr("1 o-> 2 o-o 3 <- 4 -- 5 -o 6 <- 7"))
gr76t <- standardizeEdges(graphCr("1 o-> 2 o-o 3 <- 4 -- 5 -o 6 --> 7"))
test_that("tail transform works", {
expect_equal(standardizeEdges(chgEnds(gr, 1L, 2L, to="tail")), gr12t)
expect_equal(standardizeEdges(chgEnds(gr, 2L, 1L, to="tail")), gr21t)
expect_equal(standardizeEdges(chgEnds(gr, 2L, 3L, to="tail")), gr23t)
expect_equal(standardizeEdges(chgEnds(gr, 3L, 2L, to="tail")), gr32t)
expect_equal(standardizeEdges(chgEnds(gr, 3L, 4L, to="tail")), gr0)
expect_equal(standardizeEdges(chgEnds(gr, 4L, 3L, to="tail")), gr43t)
expect_equal(standardizeEdges(chgEnds(gr, 4L, 5L, to="tail")), gr0)
expect_equal(standardizeEdges(chgEnds(gr, 5L, 4L, to="tail")), gr0)
expect_equal(standardizeEdges(chgEnds(gr, 6L, 5L, to="tail")), gr0)
expect_equal(standardizeEdges(chgEnds(gr, 5L, 6L, to="tail")), gr56t)
expect_equal(standardizeEdges(chgEnds(gr, 6L, 7L, to="tail")), gr67t)
expect_equal(standardizeEdges(chgEnds(gr, 7L, 6L, to="tail")), gr76t)
expect_equal(standardizeEdges(chgEnds(gr, 5L, 1L, to="tail")), gr0)
})
gr12c <- standardizeEdges(graphCr("1 o-o 2 o-o 3 <- 4 -- 5 -o 6 <-> 7"))
gr34c <- standardizeEdges(graphCr("1 o-> 2 o-o 3 <-o 4 -- 5 -o 6 <-> 7"))
gr43c <- standardizeEdges(graphCr("1 o-> 2 o-o 3 o- 4 -- 5 -o 6 <-> 7"))
gr45c <- standardizeEdges(graphCr("1 o-> 2 o-o 3 <- 4 -o 5 -o 6 <-> 7"))
gr54c <- standardizeEdges(graphCr("1 o-> 2 o-o 3 <- 4 o- 5 -o 6 <-> 7"))
gr65c <- standardizeEdges(graphCr("1 o-> 2 o-o 3 <- 4 -- 5 o-o 6 <-> 7"))
gr67c <- standardizeEdges(graphCr("1 o-> 2 o-o 3 <- 4 -- 5 -o 6 <-o 7"))
gr76c <- standardizeEdges(graphCr("1 o-> 2 o-o 3 <- 4 -- 5 -o 6 o-> 7"))
test_that("circle transform works", {
expect_equal(standardizeEdges(chgEnds(gr, 1L, 2L, to="circle")), gr12c)
expect_equal(standardizeEdges(chgEnds(gr, 2L, 1L, to="circle")), gr0)
expect_equal(standardizeEdges(chgEnds(gr, 2L, 3L, to="circle")), gr0)
expect_equal(standardizeEdges(chgEnds(gr, 3L, 2L, to="circle")), gr0)
expect_equal(standardizeEdges(chgEnds(gr, 3L, 4L, to="circle")), gr34c)
expect_equal(standardizeEdges(chgEnds(gr, 4L, 3L, to="circle")), gr43c)
expect_equal(standardizeEdges(chgEnds(gr, 4L, 5L, to="circle")), gr45c)
expect_equal(standardizeEdges(chgEnds(gr, 5L, 4L, to="circle")), gr54c)
expect_equal(standardizeEdges(chgEnds(gr, 6L, 5L, to="circle")), gr65c)
expect_equal(standardizeEdges(chgEnds(gr, 5L, 6L, to="circle")), gr0)
expect_equal(standardizeEdges(chgEnds(gr, 6L, 7L, to="circle")), gr67c)
expect_equal(standardizeEdges(chgEnds(gr, 7L, 6L, to="circle")), gr76c)
expect_equal(standardizeEdges(chgEnds(gr, 5L, 1L, to="circle")), gr0)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.