R/GNARtoigraph.R

Defines functions GNARtoigraph

Documented in GNARtoigraph

GNARtoigraph<- function(net=GNAR::fiveNet, stage=1, normalise=FALSE){
  stopifnot(is.GNARnet(net))
  weimat <- as.matrix(x=net, stage=stage, normalise=normalise)
  #set as undirected igraph if adjacency matrix is symmetric
  if(all(isSymmetric(weimat))){
    tmp <- graph.adjacency(weimat, mode="undirected", weighted=TRUE)
  }else{
    tmp <- graph.adjacency(weimat, mode="directed", weighted=TRUE)
  }
  return(tmp)
}

Try the GNAR package in your browser

Any scripts or data that you put into this service are public.

GNAR documentation built on April 28, 2023, 1:12 a.m.