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)
get.dyads.eids(x, tails, heads, neighborhood = c("out", "in", "combined"))network v). defaults to 'combined' for undirected networks get.edges, a list of edges. For get.edgeIDs, a vector of edge ID numbers. For get.edgeIDs, a list of edge IDs corresponding to the dyads defined by the vertex ids in tails and heads
get.edges returns all out-, in-, or out- and in-edges containing v. get.edgeIDs is identical, save in its return value, as it returns only the ids of the edges. 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. Note that for multiplex networks, multiple edges or edge ids can be returned.
The function get.dyads.eids simplifies the process of looking up the edge ids associated with a set of 'dyads' (tail and head vertex ids) for edges. It only is intended for working with non-multiplex networks and will return a warning and NA value for any dyads that correspond to multiple edges. The value numeric(0) will be returned for any dyads that do not have a corresponding edge.
get.neighborhood, valid.eids #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")
Run the code above in your browser using DataLab