annotate toolboxes/FullBNT-1.0.7/GraphViz/Old/draw_dot.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 function draw_dot(adj);
wolffd@0 2 %
wolffd@0 3 % draw_dot(name)
wolffd@0 4 %
wolffd@0 5 % Sample code illustrating use of dot_to_graph.m function
wolffd@0 6 % Leon Peshkin
wolffd@0 7 if ispc, shell = 'dos'; else, shell = 'unix'; end % Which OS ?
wolffd@0 8
wolffd@0 9 cmdline = strcat(shell,'(''neato -V'')');
wolffd@0 10 status = eval(cmdline);
wolffd@0 11 [status, result] = dos('neato -V'); % request version to check NEATO
wolffd@0 12 if status == 1, fprintf('Complaining \n'); exit, end
wolffd@0 13
wolffd@0 14 tmpDOTfile = '_GtDout.dot'; % to be platform independant no use of directories
wolffd@0 15 tmpLAYOUT = '_LAYout.dot';
wolffd@0 16 directed = 0; % assume UN-directed graph
wolffd@0 17 graph_to_dot(adj > 0, 'directed', directed, 'filename', tmpDOTfile); % save in file
wolffd@0 18
wolffd@0 19 cmdline = strcat([shell '(''neato -Tdot ' tmpDOTfile ' -o ' tmpLAYOUT ''')']); % preserve trailing spaces
wolffd@0 20 status = eval(cmdline); % get NEATO todo layout
wolffd@0 21
wolffd@0 22 [adj, labels, x, y] = dot_to_graph(tmpLAYOUT); % load layout
wolffd@0 23 delete(tmpLAYOUT); delete(tmpDOTfile); % clean up temporary files
wolffd@0 24
wolffd@0 25 figure(1); clf; axis square % now plot
wolffd@0 26 [x, y, h] = draw_graph(adj>0, labels, zeros(size(x,2),1), x, y);