Recursive function to traverse the meta-path until it is expounded. The variable mp is a list of node types (i.e., a meta-path), which is shortened on each call of traverse_mp().

traverse_mp(
  roots,
  mp,
  step = 1,
  reference_list,
  list_type = c("edge", "neighbor"),
  verbose = TRUE
)

Arguments

roots

ID of the root node on the first iteration, otherwise, data.table of growing paths.

mp

List of node types (i.e., a meta-path).

step

Counter for recursive function.

reference_list

Either an edge list as a data.table or a neighbor reference object constructed by get_neighbor_list(). If an edge list is provided, the data.table 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.

list_type

If an edge list is provided, specify "edge". If a neighbor list is provided, specify "neighbor".

verbose

Should intermediate calculations be printed to console?

Value

List of all meta-paths from the root node following a specific meta-path, as a data.table.

See also

get_neighbor_list() for neighbor reference object construction.