get_parents: Get Parent Nodes from a Given Node

View source: R/get_parents.R

get_parentsR Documentation

Get Parent Nodes from a Given Node

Description

This function identifies the parent nodes of a given node in a hierarchical structure. It checks which nodes in the provided list contain the specified node, thereby determining its parent nodes.

Usage

get_parents(node, node_list)

Arguments

node

A vector representing a single node whose parents are to be found. It is expected to contain the elements that may be present in the parent nodes.

node_list

A list of vectors, where each vector represents a node in the hierarchical structure. The function will search through these nodes to find parents of the specified node.

Details

The function works by applying a logical check across the 'node_list'. It returns the indices of all nodes that contain all elements of the specified node vector. If no parent nodes are found, the function will return an empty integer vector.

Value

A numeric vector containing the indices of the parent nodes in the 'node_list' that include the specified node.


funMoDisco documentation built on April 16, 2025, 1:10 a.m.