R/dual.R

Defines functions dual

Documented in dual

##' Dual Graphs
##' 
##' Constructs the (undirected) dual graph for a mixed graph
##' 
##' @param graph a mixed graph object
##' 
##' @details Uses the skeleton and then inverts the set of edges
##' 
##' @export
dual <- function(graph) {
  n <- nv(graph)
  out <- withAdjMatrix(skeleton(graph), force=TRUE)
  out$edges$undirected[graph$v, graph$v] <- (1 - diag(n)) - out$edges$undirected[graph$v, graph$v]
  
  out
}
rje42/MixedGraphs documentation built on March 20, 2024, 8:09 a.m.