Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Geodesic distance from an adjacency matrix
Date: Tue, 30 Nov 2010 05:09:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 26
Message-ID: <id20th$7fi$1@fred.mathworks.com>
References: <gnul3m$49q$1@fred.mathworks.com> <1bf1f628-7ca5-4aa4-9a25-6c19cf80c7e2@h5g2000yqh.googlegroups.com> <go3j6h$iq3$1@fred.mathworks.com> <gpcgbh$82b$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1291093745 7666 172.30.248.38 (30 Nov 2010 05:09:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 30 Nov 2010 05:09:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2635589
Xref: news.mathworks.com comp.soft-sys.matlab:691085

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <gpcgbh$82b$1@fred.mathworks.com>...
> "Russ Branaghan" <russ.branaghan.nospam@asu.edu> wrote in message <go3j6h$iq3$1@fred.mathworks.com>...
> > "russell.fung@gmail.com" <russell.fung@gmail.com> wrote in message <1bf1f628-7ca5-4aa4-9a25-6c19cf80c7e2@h5g2000yqh.googlegroups.com>...
> > > You may want to look at Floyd's algorithm.
> > > Russell
> > Thank you Russell. Will do.
> 
>   Russ, I laid your problem aside and am only now getting back to it.  The following is another way of solving your problem.  Let me know how well it measures up to Floyd's algorithm.  This is also an order n^3 algorithm.  Call the adjacency matrix 'a'.
> 
>  n = size(a,1);
>  c = repmat(inf,n,n);
>  for k = 1:n
>    f = k;
>    s = 0;
>    while ~isempty(f)
>      c(k,f) = s;
>      s = s+1;
>      f = find(any(a(f,:),1)&c(k,:)==inf);
>    end
>  end
> 
> The matrix c is then the desired distance matrix.
> 
> Roger Stafford

will this algo can be used for vertex weight greater one..how this could be modified