R/from_igraph.R

Defines functions from_igraph

Documented in from_igraph

from_igraph <- function(net) {
  if (!is(net,"igraph")) {
    stop("net must be an object of class igraph.")  
  }
  graph <- matrix(as.numeric(as.matrix(as_data_frame(net))), ncol = 3)
  if (is_directed(net))
    type <- "directed"
  else type <- "undirected"
  result <- list(graph = graph, type = type, PA = NULL, fitness = NULL)
  class(result) <- "PAFit_net"
  return(result)
}

Try the PAFit package in your browser

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

PAFit documentation built on June 22, 2024, 11:06 a.m.