Skip to contents

Methods for converting node_vec, agg_vec, agg_df, and edge_vec objects to igraph::igraph() objects using igraph::graph_from_edgelist().

Usage

# S3 method for class 'agg_vec'
as.igraph(x, ...)

# S3 method for class 'agg_df'
as.igraph(x, ...)

# S3 method for class 'node_vec'
as.igraph(x, ...)

# S3 method for class 'edge_vec'
as.igraph(x, ...)

Arguments

x

A node_vec, agg_vec, agg_df, or edge_vec object.

...

Additional arguments (currently unused).

Value

An igraph::igraph() object.

Examples

if (requireNamespace("igraph", quietly = TRUE)) {
  g <- node_vec(
    x = c("A", "B", "C"),
    from = c(1L, 2L),
    to = c(2L, 3L)
  )
  igraph::as.igraph(g)
}
#> IGRAPH 17f23eb D--- 3 2 -- 
#> + edges from 17f23eb:
#> [1] 1->2 2->3