EdgelistFromIgraph {dils}R Documentation

Convert an igraph to filled edgelist

Description

Given an igraph object for a network return a data.frame listing all possible edges and the weights for each edge.

Usage

  EdgelistFromIgraph(g, useWeight = FALSE)

Arguments

g

igraph, from igraph package.

useWeight

logical, Should E(g)$weight be used as the weights for the edges?

Details

This function is preferred to the igraph function get.edgelist because get.edgelist only returns rows for edges that have non-zero weight and does not return weights, if present.

Value

data.frame, full list of all possible edges with weights for each in third column.

Author(s)

Stephen R. Haptonstahl srh@haptonstahl.org

References

https://github.com/shaptonstahl/

See Also

EdgelistFromAdjacency

Examples

g <- erdos.renyi.game(10, 2/10)
EdgelistFromIgraph(g)

V(g)$name <- letters[1:vcount(g)]
EdgelistFromIgraph(g)

E(g)$weight <- runif(ecount(g))
EdgelistFromIgraph(g, useWeight=TRUE)

[Package dils version 0.8.1 Index]