Adjacency matrix for a graph

Hi All,
I am trying to calculate adjacency matrix for double data type. I have starting and ending node for graph and it is randomly numbered as follows. Start:63584 end:42800 start:115316 end:42838 There are 5400 such entries. Could anyone help me how to calculate adjacency matrix ?
Thanks and Regards Shreyas

답변 (1개)

Matt J
Matt J 2013년 9월 30일

0 개 추천

AdjMatrix = sparse(NodeStarts,NodeEnds,true);

댓글 수: 2

shreyas
shreyas 2013년 9월 30일
Thanks Matt J,but this command doesn't work on double data type and doesn't run even when I convert double to int 32.
Matt J
Matt J 2013년 9월 30일
편집: Matt J 2013년 9월 30일
Works fine for me. E.g.,
>> NodeStarts=[1,2]; NodeEnds=[5,7]; AdjMatrix=sparse(NodeStarts,NodeEnds,true)
AdjMatrix =
(1,5) 1
(2,7) 1
>> whos
Name Size Bytes Class Attributes
AdjMatrix 2x7 82 logical sparse
NodeEnds 1x2 16 double
NodeStarts 1x2 16 double

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

태그

질문:

2013년 9월 30일

댓글:

2013년 9월 30일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by