graph - How to create Adjacency Matrix for dataset in Matlab? -
i new user of matlab , need in creating adjacency matrix data set. dataset in following pattern
a=[ 0 1 0 2 0 5 1 2 1 3 1 4 2 3 2 5 3 1 3 4 3 5 4 0 4 2 5 2 5 4 ];
the adjacency matrix above be
m= 0 1 1 0 0 1 0 0 1 1 1 0 0 0 0 1 0 1 0 1 0 0 1 1 1 0 1 0 0 0 0 0 1 0 1 0
i need code perform above task in matlab
you use sparse
. please take @ function, give problem try, , check hovering mouse on following rectangle:
full(sparse(a(:,1)+1, a(:,2)+1, 1))
Comments
Post a Comment