as.edgelist {ergm}R Documentation

Convert a network object into a numeric edgelist matrix

Description

Constructs an edgelist in the format expected by ergm's internal functions

Usage

## S3 method for class 'network'
as.edgelist(x, attrname = NULL, as.sna.edgelist = FALSE, 
                            inverted = NULL, ...)
## S3 method for class 'matrix'
as.edgelist(x, n, directed = TRUE, bipartite = FALSE, 
                            loops = FALSE, inverted = FALSE, ...)

Arguments

x

a network object with additional class added indicating how it should be dispatched.

attrname

optionally, the name of an edge attribute to use for edge values

as.sna.edgelist

logical; should the edgelist be returned in edgelist form expected by the sna package?

inverted

logical; value is passed to the 'inverted' flag on the edgelist returned

n

integer number of vertices in network, value passed to the 'n' flag on edgelist returned

directed

logical; is network directed, value passed to the 'directed' flag on edgelist returned

bipartite

logical or integer; is network bipartite, value passed to the 'bipartite' flag on edgelist returned

loops

logical; are self-loops allowed in network?, value passed to the 'loops' flag on edgelist returned

...

additional arguments to other methods

Details

Constructs an edgelist matrix from a network, sorted tails-major order, with tails first, and, for undirected networks, tail < head.

The as.matrix.network(nw, matrix.type="edgelist") provides similar functionality but it does not enforce ordering..

Value

a two-column matrix of integers giving the tail (source) and head (target) indices of each edge. The edgelist has additional attributes attached to it

Note

NOTE THAT THIS FUNCTION WILL PROBABLY BE TRANSFERED TO THE network PACKAGE IN THE NEAR FUTURE

See Also

See also as.matrix.network.edgelist

Examples

data(faux.mesa.high)
as.edgelist(faux.mesa.high)

[Package ergm version 3.4.0 Index]