Learn R Programming

network (version 0.5-4)

edgeset.constructors: Edgeset Constructors for Network Objects

Description

These functions convert relational data in matrix form to network edge sets.

Usage

network.adjacency(x, g, ignore.eval = TRUE, names.eval = NULL, ...)
network.edgelist(x, g, ignore.eval = TRUE, names.eval = NULL, ...)
network.incidence(x, g, ignore.eval = TRUE, names.eval = NULL, ...)
network.bipartite(x, g, ignore.eval = TRUE, names.eval = NULL, ...)

Arguments

x
a matrix containing edge information
g
an object of class network
ignore.eval
logical; ignore edge values?
names.eval
the edge attribute under which to store edge values, if any
...
additional arguments to add.edge

Value

  • An object of class network

Details

Each of the above functions takes a network and a matrix as input, and returns a network object whose edgeset reflects the given information. network.adjacency takes x to be an adjacency matrix; code.edgelist takes x to be an edgelist matrix; and network.incidence takes x to be an incidence matrix. network.bipartite takes x to be an adjacency matrix where the rows are thge actors and the columns are the events; If ignore.eval==FALSE, (non-zero) edge values are stored as edgewise attributes with name names.eval. Any additional command line parameters are passed to add.edge.

References

Butts, C.T. 2002. ``Memory Structures for Relational Data in R: Classes and Interfaces'' Working Paper.

See Also

network, network.initialize, add.edge

Examples

Run this code
#Create an arbitrary adjacency matrix
m<-matrix(rbinom(25,1,0.5),5,5)
diag(m)<-0

g<-network.initialize(5)    #Initialize the network
g<-network.adjacency(m,g)   #Import the edge data

Run the code above in your browser using DataLab