get.edges {network}R Documentation

Retrieve Edges or Edge IDs Associated with a Given Vertex

Description

get.edges retrieves a list of edges incident on a given vertex; get.edgeIDs returns the internal identifiers for those edges, instead. Both allow edges to be selected based on vertex neighborhood and (optionally) an additional endpoint.

Usage

get.edges(x, v, alter = NULL, neighborhood = c("out", "in",
    "combined"), na.omit = TRUE)
get.edgeIDs(x, v, alter=NULL, neighborhood=c("out","in","combined"),
    na.omit=TRUE)

Arguments

x

an object of class network

v

a vertex ID

alter

optionally, the ID of another vertex

neighborhood

an indicator for whether we are interested in in-edges, out-edges, or both (relative to v)

na.omit

logical; should we omit missing edges?

Details

By default, get.edges returns all out-, in-, or out- and in-edges containing v. (get.edgeIDs is identical, save in its return value.) Specifying a vertex in alter causes these edges to be further selected such that alter must also belong to the edge – this can be used to extract edges between two particular vertices. Omission of missing edges is accomplished via na.omit.

Value

For get.edges, a list of edges. For get.edgeIDs, a vector of edge ID numbers.

Author(s)

Carter T. Butts buttsc@uci.edu

References

Butts, C. T. (2008). “network: a Package for Managing Relational Data in R.” Journal of Statistical Software, 24(2). http://www.jstatsoft.org/v24/i02/

See Also

get.neighborhood

Examples

#Create a network with three edges
m<-matrix(0,3,3)
m[1,2]<-1; m[2,3]<-1; m[3,1]<-1
g<-network(m)

get.edges(g,1,neighborhood="out")
get.edgeIDs(g,1,neighborhood="in")

[Package network version 1.7 Index]