how to find short paths and diameter for sparse matrix

1 次查看(过去 30 天)
Dear,
i need to find the diameter for a sparse matrix in matlab and the files i found is
all_shortest_paths(A,varargin) and depth_first_search(A,u,dfs_visitor,varargin)
from file exchange, both of them need to use this file check_matlab_bgl(A,options) which is checks the input A for various properties one of them if it is sparse then it will give error. My question is their anyone know how to compute the diameter for sparse matrix , even if it is still sparse I need to compute the diameter. I found this command in matlab
[dist] = graphallshortestpaths(G)
i think its useful but its confusing how to use it, can anyone use it to this matrix
A=[10000000000000000000
01000000000000000000
00001100001000000100
00010000000000000000
00100000001000001000
00100100001000000000
00000000000010000000
00000001000000000001
00000000100100000000
00000000010000000000
00101100001000000000
00000000100000000001
00010000000000010000
00000000000001000000
00000100000000000000
00000000000000010000
00000010000000000001
10000010000000010000
00000000100000000010
00000001000000100000
];
Regards,
Nadia

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Sparse Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by