Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Using Graphviz in Matlab.
Date: Wed, 14 Oct 2009 23:47:02 +0000 (UTC)
Organization: The MathWorks Inc
Lines: 39
Message-ID: <hb5ntm$49r$1@fred.mathworks.com>
References: <hb526j$if1$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1255564022 4411 172.30.248.35 (14 Oct 2009 23:47:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 14 Oct 2009 23:47:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 222043
Xref: news.mathworks.com comp.soft-sys.matlab:577373


Hello there:
If you have the Bioinformatics Toolbox you can replace draw_dot with the following function:

function [x,y] = draw_dot(cm)
  bg = biograph(cm);
  dolayout(bg)
  xy = cell2mat(get(bg.Nodes,'Position'));
  x = xy(:,1);
  y = xy(:,2);
end % function draw_dot

also look at the function GRAPHCONNCOMP.

HTH
Lucio


"Owen " <owen.daniel@removethis.warwick.ac.uk> wrote in message <hb526j$if1$1@fred.mathworks.com>...
> Hi,
> 
> I am trying to use Matlab for some graph theory problems, and have been trying to follow this (http://www.stanford.edu/~dgleich/demos/matlab/random_graphs/erdosreyni.html) tutorial for random graphs which uses the program Graphviz. I have also downloaded the relevant interface (http://www.mathworks.com/matlabcentral/fileexchange/4518) between matlab and graphviz.
> 
> However, when I try to run through the example problem (in the first link), I get an error. After entering
> 
> [x,y] = draw_dot(G);
> 
> I get the following error,
> 
> ??? Attempted to access node_pos(2); index out of bounds because numel(node_pos)=1.
> 
> Error in ==> dot_to_graph at 94
>         y(lst_node) = node_pos(2);
> 
> Error in ==> draw_dot at 30
> [trash, names, x, y] = dot_to_graph(tmpLAYOUT);  % load NEATO layout
> 
> Is anybody able to explain how to get around this?
> 
> Thank you.