File: test_dominator.tree.R

package info (click to toggle)
r-cran-igraph 1.0.1-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 18,232 kB
  • sloc: ansic: 173,538; cpp: 19,365; fortran: 4,550; yacc: 1,164; tcl: 931; lex: 484; makefile: 149; sh: 9
file content (22 lines) | stat: -rw-r--r-- 871 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

context("dominator_tree")

test_that("dominator_tree works", {
  library(igraph)
  g <- graph_from_literal(R-+A:B:C, A-+D, B-+A:D:E, C-+F:G, D-+L,
                 E-+H, F-+I, G-+I:J, H-+E:K, I-+K, J-+I,
                 K-+I:R, L-+H)
  dtree <- dominator_tree(g, root="R")

  dtree$dom <- V(g)$name[ as.vector(dtree$dom) ]
  dtree$leftout <- V(g)$name[ dtree$leftout ]
  expect_that(dtree$dom, equals(c("R", "R", "R", "R", "R", "C", "C",
                                  "D", "R", "R", "G", "R")))
  expect_that(dtree$leftout, equals(character()))
  expect_that(as_edgelist(dtree$domtree),
              equals(structure(c("R", "R", "R", "R", "R", "C", "C",
                                 "D", "R", "R", "G", "R", "A", "B",
                                 "C", "D", "E", "F", "G", "L", "H",
                                 "I", "J", "K"), .Dim = c(12L, 2L))))

})