Is there a function in igraph that can return the shortest paths under the constraint that the path should not exceed a limit for a number of edges? For example, the focal vertex is A in an undirected graph, and I want to get the shortest paths from A to other vertices such as B, C, and D, etc, but the path should be within 2 edges. So something like A-B-C-D should not be included because it takes 3 edges for A to reach D. It is very inefficient to first get all shortest paths and then drop those that exceed the limit, because I have a large graph with more than twenty thousand vertices.

Thank you for any advice!

No, but there is already a feature request and contributions are welcome.

However, many of the functions that use shortest paths already have a cutoff feature implemented. Can you explain what you need this for? Maybe there is already a solution.

If the vertex is too far away, it may not have meaningful impact on the focal vertex. I would like to find all other vertices within a certain distance that can be expected to have some impact on the focal vertex. Since I have a very large graph, it really wastes time if the algorithm does not have a cutoff for distance.

That is not the same thing as finding shortest paths.

You can use `neighborhood()`

.