getChildParentsFromGraph: Get the list of relations in a graph

View source: R/structuralLearning.R

getChildParentsFromGraphR Documentation

Get the list of relations in a graph

Description

Compute the parents of each variable in the graph.

Usage

getChildParentsFromGraph(graph, nameVars = NULL)

Arguments

graph

A directed acyclic graph of the class "graphNEL", "network" or "bn".

nameVars

A character array containing the names of the variables in the graph. This parameter is only used when graph is of class "network".

Value

A list where each element is a vector containing the name of a variable and its parents in the graph.

Examples


## Data
data(ecoli)
ecoli <- ecoli[,-1] ## Sequence Name

## DAG1
dag1 <- LearningHC(ecoli)
dag1
plot(dag1)
getChildParentsFromGraph(dag1)

## DAG2
dag2 <- LearningHC(ecoli, numIntervals = 10)
dag2
plot(dag2)
getChildParentsFromGraph(dag2)


MoTBFs documentation built on April 18, 2022, 5:06 p.m.