|
"Preet Desai" <preet.desai.nospam@matchworks.com> wrote in message <gru2dd$tu$1@fred.mathworks.com>...
> I'm trying to figure out how to make graphs with sparse matrices (like shown in the bionformatics functions), but I have no idea what
>
> m('ABC') = [1 2 3] does. I get a 1x67 matrix with the last three numbers (1,2,3)...
> Where did 67 come from? Please help me out with this... or tell me what to search for, for more information.
>
>
> Preet
Preet:
"m" is a convenience index vector that helps you define a graph when node IDs are characters, lets say you want to create a graph with three nodes ('A','B','C') and three edges ('A->B','C->A','B->C'), then you can use 'm' to create the indices for sparse:
sparse(m('ACB'),m('BAC'),1,3,3)
ans =
(3,1) 1
(1,2) 1
(2,3) 1
Of course you could have also use:
sparse([3 1 2],[1 2 3],1,3,3)
ans =
(3,1) 1
(1,2) 1
(2,3) 1
Lucio
|