Mercurial > hg > camir-aes2014
annotate toolboxes/graph_visualisation/graphViz4Matlab/layouts/Treelayout.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 classdef Treelayout < Gvizlayout |
wolffd@0 | 2 % A layout that also uses graphviz but calls dot instead of neato to |
wolffd@0 | 3 % to display the graph like a tree. |
wolffd@0 | 4 % |
wolffd@0 | 5 % Matthew Dunham |
wolffd@0 | 6 % University of British Columbia |
wolffd@0 | 7 % http://www.cs.ubc.ca/~mdunham/ |
wolffd@0 | 8 |
wolffd@0 | 9 methods |
wolffd@0 | 10 function obj = Treelayout(name) |
wolffd@0 | 11 if(nargin < 1) |
wolffd@0 | 12 obj.name = 'Treelayout'; |
wolffd@0 | 13 else |
wolffd@0 | 14 obj.name = name; |
wolffd@0 | 15 end |
wolffd@0 | 16 %obj.setImage([0,153,102]/255); |
wolffd@0 | 17 load glicons; |
wolffd@0 | 18 obj.image = icons.tree; |
wolffd@0 | 19 obj.shortDescription = 'Tree Layout (GraphViz)'; |
wolffd@0 | 20 end |
wolffd@0 | 21 |
wolffd@0 | 22 function available = isavailable(obj) |
wolffd@0 | 23 % Make sure graphViz is available. |
wolffd@0 | 24 available = Gvizlayout.queryGviz('dot'); |
wolffd@0 | 25 if(not(available)) |
wolffd@0 | 26 fprintf('Please install or upgrade graphViz\n'); |
wolffd@0 | 27 end |
wolffd@0 | 28 end |
wolffd@0 | 29 |
wolffd@0 | 30 end |
wolffd@0 | 31 |
wolffd@0 | 32 methods(Access = 'protected') |
wolffd@0 | 33 |
wolffd@0 | 34 function callGraphViz(obj) |
wolffd@0 | 35 % Call GraphViz to determine an optimal layout. Write this layout in |
wolffd@0 | 36 % layout.dot for later parsing. |
wolffd@0 | 37 err = system(['dot -Tdot -Gmaxiter=5000 -Gstart=7 -o ',obj.layoutFile,' ',obj.adjFile]); |
wolffd@0 | 38 if(err),error('Sorry, unknown GraphViz failure, try another layout'); end |
wolffd@0 | 39 end |
wolffd@0 | 40 |
wolffd@0 | 41 |
wolffd@0 | 42 |
wolffd@0 | 43 end |
wolffd@0 | 44 |
wolffd@0 | 45 |
wolffd@0 | 46 |
wolffd@0 | 47 |
wolffd@0 | 48 |
wolffd@0 | 49 |
wolffd@0 | 50 |
wolffd@0 | 51 end |