Add fallback when shortestPathTo fails

Due to a bug in graph-core