fixed bugs in shortest_path2. it contains the allsp formula