Daniel@0: classdef Springlayout < Gvizlayout Daniel@0: % A layout that also uses graphviz but calls twopi instead of neato to Daniel@0: % to display the graph like a tree. Daniel@0: % Daniel@0: % Matthew Dunham Daniel@0: % University of British Columbia Daniel@0: % http://www.cs.ubc.ca/~mdunham/ Daniel@0: methods Daniel@0: function obj = Springlayout(name) Daniel@0: if(nargin < 1) Daniel@0: obj.name = 'springlayout'; Daniel@0: else Daniel@0: obj.name = name; Daniel@0: end Daniel@0: load glicons; Daniel@0: obj.image = icons.spring; Daniel@0: obj.shortDescription = 'Spring Layout (GraphViz)'; Daniel@0: end Daniel@0: Daniel@0: function available = isavailable(obj) Daniel@0: % Make sure graphViz is available. Daniel@0: available = Gvizlayout.queryGviz('fdp'); Daniel@0: if(not(available)) Daniel@0: fprintf('Please install or upgrade graphViz\n'); Daniel@0: end Daniel@0: end Daniel@0: Daniel@0: end Daniel@0: Daniel@0: methods(Access = 'protected') Daniel@0: Daniel@0: function callGraphViz(obj) Daniel@0: % Call GraphViz to determine an optimal layout. Write this layout in Daniel@0: % layout.dot for later parsing. Daniel@0: err = system(['fdp -Tdot -Gmaxiter=5000 -Gstart=7 -o ',obj.layoutFile,' ',obj.adjFile]); Daniel@0: if(err),error('Sorry, unknown GraphViz failure, try another layout'); end Daniel@0: end Daniel@0: Daniel@0: Daniel@0: Daniel@0: end Daniel@0: Daniel@0: end