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

DOC: Clarify behavior of sparse.csgraph.dijkstra for directed=False #20509

Open
bdpedigo opened this issue Apr 17, 2024 · 0 comments
Open

DOC: Clarify behavior of sparse.csgraph.dijkstra for directed=False #20509

bdpedigo opened this issue Apr 17, 2024 · 0 comments
Labels
Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org scipy.sparse.csgraph

Comments

@bdpedigo
Copy link

Issue with current documentation:

https://scipy.github.io/devdocs/reference/generated/scipy.sparse.csgraph.dijkstra.html#scipy.sparse.csgraph.dijkstra

I've used sparse.csgraph.dijkstra (and visited this page) many times; today was the first time I noticed the note which says:

As currently implemented, Dijkstra’s algorithm does not work for graphs with direction-dependent distances when directed == False. i.e., if csgraph[i,j] and csgraph[j,i] are not equal and both are nonzero, setting directed=False will not yield the correct result.

I find this behavior quite unexpected - I understand not wanting to do a check for symmetry and warn the user at every input to this function, but it still seems worth advertising this content more prominently.

if csgraph[i,j] and csgraph[j,i] are not equal and both are nonzero

Also, to clarify, does this imply that if csgraph[i,j] = x (x nonzero) and csgraph[j,i] = 0, then csgraph[j,i] = 0 is implicitly treated as having valuex if directed=False?

Idea or request for content:

I suggest putting some warning about this behavior under the directed kwarg description, even if it just points users to the Notes section for more information.

I would be happy to draft a PR for this if people support it.

Additional context (e.g. screenshots, GIFs)

No response

@bdpedigo bdpedigo added the Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org scipy.sparse.csgraph
Projects
None yet
Development

No branches or pull requests

3 participants
@bdpedigo @lucascolley and others