Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: problem about graphshortestpath()
Date: Wed, 18 Mar 2009 21:55:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 16
Message-ID: <gprqjn$fki$1@fred.mathworks.com>
References: <gprnm1$rid$1@fred.mathworks.com> <gprp12$1ta$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1237413303 16018 172.30.248.37 (18 Mar 2009 21:55:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 18 Mar 2009 21:55:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:525994

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <gprp12$1ta$1@fred.mathworks.com>...
>   The function 'graphshortestpath' expects a square matrix, and you have given it only the upper half, so you will have to fill in or at least extend to a full 5 x 5 matrix before making the call.
> 
> Roger Stafford

  To enlarge upon what I said above, when you create a sparse matrix, it is possible to force a square size on it even though the area it is defined in is not square.  For example

 A = sparse([1 2 1],[1 2 3],1);

will have size(A) = [2,3], whereas

 B = sparse([1 2 1],[1 2 3],1,3,3);

gives size(B) = [3,3], even though the non-zero portions of A and B are identical.

Roger Stafford