helper for shortest paths with default edge weights=1