|
"Rahul Singhal" <rsinghalomatic@gmail.com> wrote in message <hijpq6$ckr$1@fred.mathworks.com>...
> Hi all:
> I am trying to form adjacency matrix of directed graph using sparse matrices.
> for this i am using the following graph theory function:
>
> A = sparse(x,y,true,50,50)
>
> where x and y are the row matrices showing connections between different vertices.
>
> for making x and y , I am using following rand function:
> x = randi(50,1,60)
> x = randi(50,1,60)
>
> when i run the A = sparse(x,y,true,50,50), many times it shows the error whenever there are repeated indices..
> Error using ==> sparse
> Repeated indices are not supported for sparse logical matrices.
>
> How can i create x and y so that is doesn't show this error. or is there ant other way of forming x and y matrices.. i even tried to change the rand stream for x and y , but it doesn't work.
A 50-by-50 (double) sparse matrix is not that big. I would suggest:
MyLogicalSparseMatrix = logical(sparse(x,y,1,50,50))
Jos
|