get_neighbor_list: Construct neighbors reference object.

View source: R/get-neighbor-list.R

get_neighbor_listR Documentation

Construct neighbors reference object.

Description

For a given edge list, construct a nested list (i.e., dictionary of dictionaries in Python syntax) of the neighbors of each node in the edge list stratified by type. This reference object can be used instead of the edge list in subsequent metapaths functions, since searching the edge list to recompute neighbors each time would have O(n) complexity, while searching a pre-computed neighbors dictionary requires a fixed amount of time.

Usage

get_neighbor_list(
  edge_list,
  file_path = NULL,
  intermediate_file_path = NULL,
  verbose = F
)

Arguments

edge_list

Edge list as a data.table which must contain the following columns:

Origin

IDs of the origin nodes for each edge.

Destination

IDs of the destination nodes for each edge.

OriginType

Types of the origin node for each edge.

DestinationType

Types of the destination node for each edge.

EdgeType

Types of each edge.

file_path

File path to save final data.table reference object. If no path is specified, the reference object is not saved.

intermediate_file_path

File path to save intermediate list of lists reference object. If no path is specified, the intermediate reference object is not saved.

verbose

Should node types and total node count be printed to the console?

Value

Neighbors reference object as a data.table

Examples

mtcars_neighbor_list = get_neighbor_list(mtcars_edge_list, verbose = T)
head(mtcars_neighbor_list)

ayushnoori/metapaths documentation built on March 19, 2023, 7:35 p.m.