adj.remove.cycles: Function to remove cycles that may be present in a directed...

Description Usage Arguments Details Value Author(s) Examples

Description

This function removes cycles that may be present in a directed graph represented by an adjacency matrix,

Usage

1
adj.remove.cycles(adjmat, from, maxlength)

Arguments

adjmat

adjacency matrix with positive entries represent evidence for the presence of an edge and entries less or equal than zero represent absence of an edge; parents in row, children in columns.

from

indices or names of nodes for which the cycles present in the childhood should be removed; if missing, all cycles will be removed.

maxlength

maximum length of path, once this length is reached no longer paths will be searched for.

Details

This function may be useful when it comes to generate a bayesian network using a topology identified from an source of information where cycles are allowed. When cycles are removed, the function tries to keep the most positive entries.

Value

A list of two items

adjmat.acyclic

an adjacency matrix without cycles

adjmat.removed

a matrix of booleans representing the edges that have been removed from the original adjacency matrix to make it acyclic

Author(s)

Benjamin Haibe-Kains

Examples

1
2
3
set.seed(54321)
xx <- matrix(sample(c(0,1), 100, replace=TRUE), nrow=10, ncol=10)
adj.remove.cycles(adjmat=xx, from=1, maxlength=3)

bhklab/predictionet documentation built on May 12, 2019, 8:28 p.m.