node_get_nbs: Create node features from edges

View source: R/sfn-node-get.R

node_get_nbsR Documentation

Create node features from edges

Description

Given a tidygraph object, create a list column of edge data for each node in the node context.

Usage

node_get_nbs()

node_get_edge_list()

node_get_edge_col(edges, .var)

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 a nb class object with the neighboring nodes.

    • Uses igraph::get.adjlist()

  • 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.

    • Uses igraph::get.adjedgelist().

  • node_get_edge_col(): creates a list column containing edge attributes as a list column in the node context (much like find_xj()).

    • Uses igraph::get.edge.attribute()

Value

A list column

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")
  )
}

sfdep documentation built on Jan. 11, 2023, 9:08 a.m.