EdgelistFromIgraph: Convert an igraph to filled edgelist

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/EdgelistFromIgraph.R

Description

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

Usage

1
  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

1
2
3
4
5
6
7
8
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)

dils documentation built on May 2, 2019, 8:28 a.m.