diff options
| author | ziejd2 | 2017-09-28 15:04:40 -0500 |
|---|---|---|
| committer | ziejd2 | 2017-09-28 15:04:40 -0500 |
| commit | 8070dc963753142bb86c4ed698d91fd623ed28e7 (patch) | |
| tree | d0f6dd8fc46a49b819aa55c1a90faa14d8448883 /sourcecodes/bnt-master/SLP/misc/Markov_equivalent_dags.m | |
| parent | 7cc31810d53176e805532b2789955f4eedbce6bb (diff) | |
| download | BNW-8070dc963753142bb86c4ed698d91fd623ed28e7.tar.gz | |
BNW using Octave instead of Matlab.
This version of BNW should perform the same as the original version. The only difference is that it uses Octave instead of Matlab when running BayesNet Toolbox during parameter learning. I am calling this BNW_1.02. It can be accessed at: compbio.uthsc.edu/BNW_1.02
Diffstat (limited to 'sourcecodes/bnt-master/SLP/misc/Markov_equivalent_dags.m')
| -rw-r--r-- | sourcecodes/bnt-master/SLP/misc/Markov_equivalent_dags.m | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/sourcecodes/bnt-master/SLP/misc/Markov_equivalent_dags.m b/sourcecodes/bnt-master/SLP/misc/Markov_equivalent_dags.m new file mode 100644 index 00000000..455037c9 --- /dev/null +++ b/sourcecodes/bnt-master/SLP/misc/Markov_equivalent_dags.m @@ -0,0 +1,42 @@ +function [n_dags, dag_list] = Markov_equivalent_dags(dag) + +% +% [n_dags, dag_list] = Markov_equivalent_dags(dag) +% +% generates a cell array of all Markov equivalent DAGs +% corresponding to the input DAG. +% +% YOU NEED TO HAVE THE STRUCTURE LEARNING PACKAGE IN PLACE TO USE THIS FUNCTION! +% +% Input: DAG (in standard format, i.e. dag(a,b)=1 if and only if a->b) +% +% Output: Number of DAGs generated and +% Cell array of all Markov-equivalent DAGs (in same format as input) +% +% Sample Use: +% +% Example 1: +% % Find all DAGs equivalent to DAG of Asia Network +% BN = mk_asia_bnet(); +% dag = BN.dag; +% [n_dags, dag_list] = Markov_equivalent_dags(dag); +% n_dags % Answer should be: 6 +% dag_list{1} % displays the first DAG, etc. +% +% Example 2: +% % Find all DAGs equivalent to random DAG +% dag = mk_rnd_dag(4); +% [n_dags, dag_list] = Markov_equivalent_dags(dag); +% +% Imme Ebert-Uphoff (ebert@tree.com), 2007 +% + + % find completed PDAG corresponding to DAG + cpdag = dag_to_cpdag(dag); + + % convert to our notation, i.e. directed edge has (-1) instead of (1) + signed_pdag = pdag_unsigned_to_signed(cpdag); + + % find all corresponding DAGs + [n_dags,dag_list] = pdag_to_all_dags( signed_pdag ); + |
