For shortest paths look at:
the Wikipedia page of the http://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithmFloyd–Warshall algorithm
and also:
"An algorithm for computing all paths in a graph""An algorithm for computing all paths in a graph" by Lars-Erik Thorelli http://www.springerlink.com/content/t53j31t5012v6605/ in BIT Numerical Mathematics, July 1966, Volume 6, Issue 4, pp 347-349