f.parents: Get the parents of a node OR nodes in a graph.

View source: R/graph-functions.R

f.parentsR Documentation

Get the parents of a node OR nodes in a graph.

Description

Function to extract the parents of a node OR nodes in a graph object. Parents of a node are the nodes that have directed edges pointing to the node.

Usage

f.parents(graph, nodes)

Arguments

graph

A graph object generated by the make.graph() function.

nodes

A character vector of nodes for which to extract parents.

Value

A vector of vertices contains parents set of the given nodes.

Examples

graph <- make.graph(vertices=c('A','M','L','Y','X'),
bi_edges=list(c('A','Y')),
di_edges=list(c('X','A'), c('X','M'), c('X','L'),
c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y')))
f.parents(graph, c('Y','L'))


flexCausal documentation built on March 29, 2026, 5:08 p.m.