ph(<span class="string">'all_shortest_paths_example'</span>);
A = spfun(@(x) x-min(min(A))+1,A); <span class="comment">% remove the negative edges</span>
As = convert_sparse(A);
</pre><p>Now, we'll run Dijkstra's algorithm for every vertex and save the result On my 2GHz laptop, this takes 0.000485 seconds.</p><pre class="codeinput">n = size(A,1);
D = zeros(n,n);
tic
<span class="keyword">for</span> i=1:n
    D(i,:) = dijkstra(As,i);
<span class="keyword">end</span>
toc
</pre><pre class="codeoutput">Elapsed 