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.edgeIDs(
x,
v,
alter = NULL,
neighborhood = c("out", "in", "combined"),
na.omit = TRUE
)get.edges(
x,
v,
alter = NULL,
neighborhood = c("out", "in", "combined"),
na.omit = TRUE
)
get.dyads.eids(
x,
tails,
heads,
neighborhood = c("out", "in", "combined"),
na.omit = TRUE
)
For get.edges
, a list of edges. For get.edgeIDs
, a
vector of edge ID numbers. For get.dyads.eids
, a list of edge IDs
corresponding to the dyads defined by the vertex ids in tails
and
heads
an object of class network
a vertex ID
optionally, the ID of another vertex
an indicator for whether we are interested in in-edges,
out-edges, or both (relative to v
). defaults to 'combined'
for
undirected networks
logical; should we omit missing edges?
a vector of vertex ID for the 'tails' (v) side of the dyad
a vector of vertex ID for the 'heads' (alter) side of the dyad
Carter T. Butts buttsc@uci.edu
By default, 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.
Butts, C. T. (2008). “network: a Package for Managing Relational Data in R.” Journal of Statistical Software, 24(2). tools:::Rd_expr_doi("10.18637/jss.v024.i02")
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