Mercurial > hg > camir-ismir2012
annotate toolboxes/graph_visualisation/graphViz4Matlab/layouts/Springlayout.m @ 0:cc4b1211e677 tip
initial commit to HG from
Changeset:
646 (e263d8a21543) added further path and more save "camirversion.m"
author | Daniel Wolff |
---|---|
date | Fri, 19 Aug 2016 13:07:06 +0200 |
parents | |
children |
rev | line source |
---|---|
Daniel@0 | 1 classdef Springlayout < Gvizlayout |
Daniel@0 | 2 % A layout that also uses graphviz but calls twopi instead of neato to |
Daniel@0 | 3 % to display the graph like a tree. |
Daniel@0 | 4 % |
Daniel@0 | 5 % Matthew Dunham |
Daniel@0 | 6 % University of British Columbia |
Daniel@0 | 7 % http://www.cs.ubc.ca/~mdunham/ |
Daniel@0 | 8 methods |
Daniel@0 | 9 function obj = Springlayout(name) |
Daniel@0 | 10 if(nargin < 1) |
Daniel@0 | 11 obj.name = 'springlayout'; |
Daniel@0 | 12 else |
Daniel@0 | 13 obj.name = name; |
Daniel@0 | 14 end |
Daniel@0 | 15 load glicons; |
Daniel@0 | 16 obj.image = icons.spring; |
Daniel@0 | 17 obj.shortDescription = 'Spring Layout (GraphViz)'; |
Daniel@0 | 18 end |
Daniel@0 | 19 |
Daniel@0 | 20 function available = isavailable(obj) |
Daniel@0 | 21 % Make sure graphViz is available. |
Daniel@0 | 22 available = Gvizlayout.queryGviz('fdp'); |
Daniel@0 | 23 if(not(available)) |
Daniel@0 | 24 fprintf('Please install or upgrade graphViz\n'); |
Daniel@0 | 25 end |
Daniel@0 | 26 end |
Daniel@0 | 27 |
Daniel@0 | 28 end |
Daniel@0 | 29 |
Daniel@0 | 30 methods(Access = 'protected') |
Daniel@0 | 31 |
Daniel@0 | 32 function callGraphViz(obj) |
Daniel@0 | 33 % Call GraphViz to determine an optimal layout. Write this layout in |
Daniel@0 | 34 % layout.dot for later parsing. |
Daniel@0 | 35 err = system(['fdp -Tdot -Gmaxiter=5000 -Gstart=7 -o ',obj.layoutFile,' ',obj.adjFile]); |
Daniel@0 | 36 if(err),error('Sorry, unknown GraphViz failure, try another layout'); end |
Daniel@0 | 37 end |
Daniel@0 | 38 |
Daniel@0 | 39 |
Daniel@0 | 40 |
Daniel@0 | 41 end |
Daniel@0 | 42 |
Daniel@0 | 43 end |