Added functions and test to calculate all-pair shortest paths