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
2013-9-30
AdjMatrix = sparse(NodeStarts,NodeEnds,true);
2 个评论
shreyas
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 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!