Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose sets of reachable vertices in ShortestPathAllPairs.Result #157

Open
UnasZole opened this issue Feb 22, 2025 · 0 comments
Open

Expose sets of reachable vertices in ShortestPathAllPairs.Result #157

UnasZole opened this issue Feb 22, 2025 · 0 comments

Comments

@UnasZole
Copy link

Hi,

Currently, the ShortestPathAllPairs.Result exposes only a getPath method that allows retrieving the shortest path between two known vertices - and the method returns null if there is no path.

But after running an APSP algorithm, we should have access to two other pieces of information :

  • The set of target vertices reachable from a given source vertex. (Given "S", get the set of "T" such that getPath(S,T) is not null)
  • The set of source vertices that a given target vertex is reachable from (reciprocally, given "T", the set of S such that getPath(S,T) is not null)

With the current API, the only way to get the information is to loop on all vertices of the graph and filter them, which feels quite inefficient in a large graph - whereas the APSP result already contains this information internally and could probably expose it in a much more efficient manner.

Would it be possible to add these two methods to the ShortestPathAllPairs.Result ?

  • Set listReachableTargets(vertex)
  • Set listReachableSources(vertex)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant