Description Usage Arguments Details Value Author(s) Examples
This function removes cycles that may be present in a directed graph represented by an adjacency matrix,
1 | adj.remove.cycles(adjmat, from, maxlength)
|
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. |
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.
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 |
Benjamin Haibe-Kains
1 2 3 |
Loading required package: igraph
Attaching package: 'igraph'
The following objects are masked from 'package:stats':
decompose, spectrum
The following object is masked from 'package:base':
union
Loading required package: catnet
$adjmat.acyclic
X1 X2 X3 X4 X5 X6 X7 X8 X9 X10
X1 0 0 0 1 1 1 0 0 0 0
X2 0 0 0 0 0 1 1 1 1 1
X3 0 0 0 1 1 0 0 1 1 0
X4 0 1 0 0 0 0 1 1 1 1
X5 0 1 1 1 0 1 0 1 0 1
X6 1 1 1 0 1 0 1 0 1 1
X7 0 1 1 1 1 0 0 1 1 1
X8 0 0 1 1 1 0 0 0 1 0
X9 0 1 0 1 0 0 0 0 0 1
X10 0 0 1 1 1 0 1 0 0 0
$adjmat.removed
X1 X2 X3 X4 X5 X6 X7 X8 X9 X10
X1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
X2 FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
X3 FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
X4 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
X5 FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE
X6 FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE
X7 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
X8 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
X9 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE
X10 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.