Skip to content

Rename DigraphDijkstra to DigraphShortestPaths - #958

Open
William-Kenyon wants to merge 3 commits into
digraphs:mainfrom
William-Kenyon:fix-issue-570
Open

William-Kenyon wants to merge 3 commits into
digraphs:mainfrom
William-Kenyon:fix-issue-570

Conversation

@William-Kenyon

Copy link
Copy Markdown
Collaborator

Fixes #570, renaming DigraphDijkstra to DigraphShortestPaths, using the new DIGRAPHS_DeclareObsoleteSynonym.

@codecov

codecov Bot commented Oct 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.48%. Comparing base (7c00ce7) to head (0a4f0e9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #958   +/-   ##
=======================================
  Coverage   97.48%   97.48%           
=======================================
  Files          53       53           
  Lines       21363    21364    +1     
  Branches      639      639           
=======================================
+ Hits        20825    20826    +1     
  Misses        473      473           
  Partials       65       65           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@William-Kenyon William-Kenyon added the VIP Pull requests done by participants of the VIP programme. label Oct 15, 2026

@james-d-mitchell james-d-mitchell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mtorpey can you please have a look at this.

My initial reaction is that I'm not sure this addresses #570. In particular, if there's duplicate code between DigraphDijkstra and DigraphShortestPath, then this PR does not remove it. Also if we merge this PR, there will be two functions DigraphShortestPath and DigraphShortestPaths which return two rather different outputs. Also it's not completely clear to me that DigraphShortestPaths is an entirely accurate name, given that it does not return all shortest paths from source to target as the name suggests.

Maybe I'm missing something essential, @William-Kenyon if there's context or rationale behind these changes that I'm missing, then please do let me know!

@William-Kenyon

Copy link
Copy Markdown
Collaborator Author

@james-d-mitchell My renaming follows existing convention: we already have EdgeWeightedDigraphShortestPaths, which returns similar lists of distances and predecessors, and EdgeWeightedDigraphShortestPath which returns in the DigraphPath form. I agree that the wording "paths" is ambiguous, as a user might expect all shortest paths between a source and target, but this could be added in the future under the overload: ...ShortestPaths(digraph, source, target).

The current use of the target parameter is actually as an early exit condition and is not needed anymore, I'll remove it.

As for duplication, DigraphShortestPath uses a BFS, which is slightly faster than DigraphShortestPaths's dijkstras, which is why I didn't refactor them. I realise now however that DigraphShortestPaths is obsolete when its EdgeWeighted... counterpart exists, so I'll make it unweighted and share the BFS of DigraphShortestPath.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

VIP Pull requests done by participants of the VIP programme.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename DigraphDijkstra

2 participants