# dag2eg: Transforms a DAG into an essential graph In MXM: Feature Selection (Including Multiple Solutions) and Bayesian Networks

## Description

Transforms a DAG into an essential graph.

## Usage

 `1` ```dag2eg(dag, type = NULL) ```

## Arguments

 `dag` The graph matrix as produced from `pc.or` or any other algorithm which produces directed graphs. A DAG in general. `type` This can be either NULL or 1 or 2. type = 1 means that the matrix contains 0, 1, 2, 3 where G[i, j] = g[j, i] = 0, means there is no edge between nodes i and j, G[i, j] = g[j, i] = 1, there is an edge between nodes i and j and G[i, j] = 2 and G[j, i] = 3 means that there is an arrow from node i to node j. If type 2, the matrix contains 0 for no edge and 1 for a directed edge. In this case, G[i,j]=1 and G[j,i]=0 means that there is an arrow from node i to node j. If you are not sure of what you have, just leave it NULL, the function will check to which case your matrix belongs.

## Details

The function is an R translation from an old matlab code.

## Value

The matrix of the essential graph.

## Author(s)

Ioannis Tsamardinos and Michail Tsagris

R implementation and documentation: Ioannis Tsamardinos <[email protected]> and and Michail Tsagris <[email protected]>

## References

Chickering, D.M. (1995). A transformational characterization of equivalent Bayesian network structures. Proceedings of the 11th Conference on Uncertainty in Artificial Intelligence, Montreal, Canada, 87-98.

``` plotnetwork, is.dag, topological_sort ```

## Examples

 ```1 2 3 4 5 6 7 8``` ```# simulate a dataset with continuous data # simulate a dataset with continuous data y = rdag(1000, 10, 0.3) tru = y\$G eg = dag2eg(tru) par( mfrow = c(1, 2) ) plotnetwork(tru) plotnetwork(eg) ```

MXM documentation built on April 1, 2018, 12:11 p.m.