-
Notifications
You must be signed in to change notification settings - Fork 311
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
[FEA] target to source shortest path #806
Comments
@aerdem4 getting the shortest path to just a single target vertex is just a matter of filtering the returned results down to the single path you want. There is a utility function to do that: get_traversed_path(df, id): df = cugraph.sssp(G, start_id) |
@BradReesWork but doesn't it do a redundant work then? Or did you suggest it as a work around? |
@aerdem4 The amount of time to do an all path SSSP is the same of a directed Source to Destination. We could just make an API that hides that fact |
Adding the creation of a new function to the roadmap |
I want to start working on this. @BradReesWork, can you assign it to me? |
I've been playing around with this. From looking at the networkx docs, the api for this supports more than what was requested. How important is it for the api to match exactly. Is the goal to support duck typing as much as possible? |
Adds the ability to get the length/cost of path from source to destination(s). Closely follows [`networkx.shortest_path_length`](https://networkx.org/documentation/latest/reference/algorithms/generated/networkx.algorithms.shortest_paths.generic.shortest_path_length.html#networkx.algorithms.shortest_paths.generic.shortest_path_length). Similarities: 1) Takes an optional target vertex 2) If only source is provided, a `cudf` dataframe is returned with columns: `[vertex, distance]` (similar to `networkx` dictionary return) 3) If source and target are specified the exact length is returned or `sys.float_info.max` if the vertex is not reachable. Differences: 1) Requires that source be provided, as apposed to `networkx` 2) Nethod of graph traversal is not an option. Fixes: 1) Fixes #806 2) `sssp` and `cugraph.Graph.has_node` vertex checks. Added support for checking for vertexes that are not apart of the graph. in the past, `TypeError` was raised when doing a comparison check (as apposed to `ValueError`) Authors: - John Purviance <[email protected]> - BradReesWork <[email protected]> Approvers: - Alex Fender URL: #1278
Is your feature request related to a problem? Please describe.
cugraph sssp implementation only takes source as input and calculates shortest path to all other nodes. I only need shortest path to a target node.
Describe the solution you'd like
I would like to have shortest_path_length(g, source=a, target=b) functionality similar to networkx.
The text was updated successfully, but these errors were encountered: