annotate toolboxes/FullBNT-1.0.7/GraphViz/draw_graph_test.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 % TEST_LAYOUT Script to test some bayesian net layouts
wolffd@0 2 %
wolffd@0 3
wolffd@0 4 % Change History :
wolffd@0 5 % Date Time Prog Note
wolffd@0 6 % 13-Apr-2000 10:40 PM ATC Created under MATLAB 5.3.1.29215a (R11.1)
wolffd@0 7
wolffd@0 8 % ATC = Ali Taylan Cemgil,
wolffd@0 9 % SNN - University of Nijmegen, Department of Medical Physics and Biophysics
wolffd@0 10 % e-mail : cemgil@mbfys.kun.nl
wolffd@0 11
wolffd@0 12 %bnet = mk_asia_bnet;
wolffd@0 13 %draw_graph(bnet.dag);
wolffd@0 14
wolffd@0 15 % Make the following network (from Jensen (1996) p84 fig 4.17)
wolffd@0 16 % 1
wolffd@0 17 % / | \
wolffd@0 18 % 2 3 4
wolffd@0 19 % | | |
wolffd@0 20 % 5 6 7
wolffd@0 21 % \/ \/
wolffd@0 22 % 8 9
wolffd@0 23 % where all arcs point downwards
wolffd@0 24
wolffd@0 25 disp('plot directed')
wolffd@0 26 clf;
wolffd@0 27
wolffd@0 28 N = 9;
wolffd@0 29 dag = zeros(N,N);
wolffd@0 30 dag(1,2)=1; dag(1,3)=1; dag(1,4)=1;
wolffd@0 31 dag(2,5)=1; dag(3,6)=1; dag(4,7)=1;
wolffd@0 32 dag(5,8)=1; dag(6,8)=1; dag(6,9)=1; dag(7,9) = 1;
wolffd@0 33
wolffd@0 34 draw_graph(dag);
wolffd@0 35
wolffd@0 36 pause
wolffd@0 37 clf
wolffd@0 38 disp('plot undirected')
wolffd@0 39 udag = [dag+dag'];
wolffd@0 40 draw_graph(udag);
wolffd@0 41
wolffd@0 42 pause
wolffd@0 43 clf
wolffd@0 44 disp('plot mixed')
wolffd@0 45 mg = [dag];
wolffd@0 46 mg(2,1) = 1; mg(8,5) = 1;
wolffd@0 47 draw_graph(mg);
wolffd@0 48
wolffd@0 49
wolffd@0 50