The shortestpath command takes a (square) adjacency matrix A whose entries are edge weights and computes a shortest path from u to v in the network. If only A and u are given, the shortest path from u to every other vertex is computed and returned in a vector. If only A is given, the shortest path between all pairs of vertices are computed and returned in a matrix.
A = [[0,1,4],[1,0,1],[3,1,0]]; shortestpath(A,0,2); [0, 1, 2] shortestpath(A,0); [[0], [0, 1], [0, 1, 2]] shortestpath(A); [[[0], [0, 1], [0, 1, 2]], [[1, 0], [1], [1, 2]], [[2, 1, 0], [2, 1], [2]]]