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$>
References: <gprnm1$rid$> <gprp12$1ta$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: 1237413303 16018 (18 Mar 2009 21:55:03 GMT)
NNTP-Posting-Date: Wed, 18 Mar 2009 21:55:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:525994

"Roger Stafford" <> wrote in message <gprp12$1ta$>...
>   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