get.edges {network} | R Documentation |
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.
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)
x |
an object of class |
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 |
na.omit |
logical; should we omit missing edges? |
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
.
For get.edges
, a list of edges. For get.edgeIDs
, a vector of edge ID numbers.
Carter T. Butts buttsc@uci.edu
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/
#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")