Dijkstra:
function [dist,pre, full_path]=MinRoad_Dijkstra(G,v0)n=0;if isfield(G,'w') && ~isempty(G.w) && size(G.w,1)==size(G.w,2) W=G.w;n=size(W,1);enddist=W(v0,:);pre=v0*ones(1,n);full_path=cell(1,n);for i=1:n if i~=v0 full_path{i}=v0; endendfor k=2:n-1 for i=1:n for j=1:n if (j==i) continue; end d=dist(j)+W(j,i); if d