The code now stores the actual shortest paths to reach vertices