Extract the edge id's for given sets of ego(s) and alter(s)
extract_edge_id(object, ego, alter, edgelist, ordered = FALSE)
graph of class network
or igraph
numeric vector with the vertex id's
numeric vector with the vertex id's
matrix or data.frame with two numeric columns,
containing the vertex id's. Is ignored when ego
and/or alter
are (is) specified.
logical, should the output be ordered according to the edgelist
data.frame with three columns: ego (=sender), alter (=receiver), eid (= edge id)
This is a utility function that extracts the id of specific edges.
This is mainly useful when working with the same graph, both as a network
and igraph
object, because these objects are constructed differently
and internally order the edges differently.
There are three arguments that help determine for which edges the id's are extracted.
When only ego
is specified, all edges are included that have an 'ego'
node as the sender (in case of a directed graph) or as a sender or receiver
(in case of an undirected graph).
When only alter
is specified, all edges are included that have an 'alter'
node as the receiver (in case of a directed graph) or as a sender or receiver
(in case of an undirected graph).
When both ego
and alter
are specified, edges are included that
have an 'ego' as the sender and an 'alter' as receiver (or vice versa, in
case of an undirected graph).
When only edgelist
is specified, the exact edges specified in that
edgelist are used.
In case an id is requested for an edge that does not occur in the graph, zero is returned for that non-existent edge(s).
Note that ego
, vertex
, and edgelist
should only contain
numeric vertex id's and will not accept vertex names in the current implementation
of this function.