File: test_graph.mincut.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 (17 lines) | stat: -rw-r--r-- 391 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

context("min_cut")

test_that("min_cut works", {

  library(igraph)

  g2 <- graph( c(1,2,2,3,3,4, 1,6,6,5,5,4, 4,1) )
  E(g2)$capacity <- c(3,1,2, 10,1,3, 2)
  mc <- min_cut(g2, value.only=FALSE)

  expect_that(mc$value, equals(1))
  expect_that(as.vector(mc$cut), equals(2))
  expect_that(as.vector(mc$partition1), equals(2))
  expect_that(as.vector(mc$partition2), equals(c(1,3:6)))

})