BUG: fix validation in csgraph.shortest_path
BUG: fix logic in shortest_path
Merge pull request #3467 from jakevdp/shortest-path-fix

BUG: fix validation in csgraph.shortest_path