Skip to contents

Convert a dgraph to igraph

Usage

as_igraph(graph, stage = "final")

Arguments

graph

A dgraph object, including isolates.

stage

Stored graph stage.

Value

An undirected igraph. Edge lengths are named length; other attributes retain their names. No implicit weight or unit lengths are added. For metric paths pass weights = igraph::E(g)$length explicitly; for hop distance pass weights = NA.

Examples

graph <- dgraph(list(2L, 1L, integer()), list(0, 0, numeric()))
ig <- as_igraph(graph)
igraph::vcount(ig)
#> [1] 3
igraph::E(ig)$length
#> [1] 0