R/igraph.R

Defines functions as.igraph.tbl_graph as_tbl_graph.igraph

Documented in as_tbl_graph.igraph

#' @describeIn tbl_graph Method for igraph object. Simply subclasses the object into a `tbl_graph`
#' @export
as_tbl_graph.igraph <- function(x, ...) {
  class(x) <- c('tbl_graph', 'igraph')
  attr(x, 'active') <- 'nodes'
  x
}

#' @importFrom igraph as.igraph
#' @export
as.igraph.tbl_graph <- function(x, ...) {
  class(x) <- 'igraph'
  attr(x, 'active') <- NULL
  x
}
#' @export
igraph::as.igraph

Try the tidygraph package in your browser

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

tidygraph documentation built on June 22, 2024, 11:32 a.m.