g <- graph_from_literal( a-b-c-d-e-f )
m1 <- c("b", "a", "d", "c", "f", "e") # maximal matching
m2 <- c("b", "a", "d", "c", NA, NA) # non-maximal matching
m3 <- c("b", "c", "d", "c", NA, NA) # not a matching
is_matching(g, m1)
is_matching(g, m2)
is_matching(g, m3)
is_max_matching(g, m1)
is_max_matching(g, m2)
is_max_matching(g, m3)
V(g)$type <- c(FALSE,TRUE)
print_all(g, v=TRUE)
max_bipartite_match(g)
g2 <- graph_from_literal( a-b-c-d-e-f-g )
V(g2)$type <- rep(c(FALSE,TRUE), length.out=vcount(g2))
print_all(g2, v=TRUE)
max_bipartite_match(g2)
#' @keywords graphs
Run the code above in your browser using DataLab