wolffd@0: function draw_dot(adj); wolffd@0: % wolffd@0: % draw_dot(name) wolffd@0: % wolffd@0: % Sample code illustrating use of dot_to_graph.m function wolffd@0: % Leon Peshkin wolffd@0: if ispc, shell = 'dos'; else, shell = 'unix'; end % Which OS ? wolffd@0: wolffd@0: cmdline = strcat(shell,'(''neato -V'')'); wolffd@0: status = eval(cmdline); wolffd@0: [status, result] = dos('neato -V'); % request version to check NEATO wolffd@0: if status == 1, fprintf('Complaining \n'); exit, end wolffd@0: wolffd@0: tmpDOTfile = '_GtDout.dot'; % to be platform independant no use of directories wolffd@0: tmpLAYOUT = '_LAYout.dot'; wolffd@0: directed = 0; % assume UN-directed graph wolffd@0: graph_to_dot(adj > 0, 'directed', directed, 'filename', tmpDOTfile); % save in file wolffd@0: wolffd@0: cmdline = strcat([shell '(''neato -Tdot ' tmpDOTfile ' -o ' tmpLAYOUT ''')']); % preserve trailing spaces wolffd@0: status = eval(cmdline); % get NEATO todo layout wolffd@0: wolffd@0: [adj, labels, x, y] = dot_to_graph(tmpLAYOUT); % load layout wolffd@0: delete(tmpLAYOUT); delete(tmpDOTfile); % clean up temporary files wolffd@0: wolffd@0: figure(1); clf; axis square % now plot wolffd@0: [x, y, h] = draw_graph(adj>0, labels, zeros(size(x,2),1), x, y);