R: Extract Egocentric Networks from Complete Network Data
ego.extract
R Documentation
Extract Egocentric Networks from Complete Network Data
Description
ego.extract takes one or more input graphs (dat) and returns a list containing the egocentric networks centered on vertices named in ego, using adjacency rule neighborhood to define inclusion.
a vector of vertex IDs, or NULL if all are to be selected.
neighborhood
the neighborhood to use.
Details
The egocentric network (or “ego net”) of vertex v in graph G is defined as G[v U N(v)] (i.e., the subgraph of G induced by v and its neighborhood). The neighborhood employed by ego.extract is selected by the eponymous argument: "in" selects in-neighbors, "out" selects out-neighbors, and "combined" selects all neighbors. In the event that one of the vertices selected by ego has no qualifying neighbors, ego.extract will return a degenerate (1 by 1) adjacency matrix containing that individual's diagonal entry.
Vertices within the returned matrices are maintained in their original order, save for ego (who is always listed first). The ego nets themselves are returned in the order specified in the ego parameter (or their vertex order, if no value was specified).
ego.extract is useful for finding local properties associated with particular vertices. To compute functions of neighbors' covariates, see gapply.
Value
A list containing the adjacency matrices for the ego nets of each vertex in ego.