Given a tidygraph object, create a list column of edge data for each node in the node context.
Arguments
- edges
an edge list as created by
node_get_edge_list()
- .var
the quoted name of a column in the edge context.
Details
node_get_nbs()
: creates a neighbor list in the nodes context based on the adjacency list. This returns anb
class object with the neighboring nodes.node_get_edge_list()
: creates an edge list. The edge list contains the row index of the edge relationships in the edge context for each node.node_get_edge_col()
: creates a list column containing edge attributes as a list column in the node context (much likefind_xj()
).
Examples
if (interactive()) {
net <- sfnetworks::as_sfnetwork(
sfnetworks::roxel
)
dplyr::mutate(
net,
nb = node_get_nbs(),
edges = node_get_edge_list(),
types = node_get_edge_col(edges, "type")
)
}