renamed AllShortestPaths to AllPairsShortestPaths as this is the correct name for the problem