Skip to content

refactor: unify Dijkstra on efficient PriorityQueue implementation#7486

Merged
DenizAltunkapan merged 3 commits into
TheAlgorithms:masterfrom
priyanshuvishwakarma273403:fix-7458-unify-dijkstra-priorityqueue
Jun 23, 2026
Merged

refactor: unify Dijkstra on efficient PriorityQueue implementation#7486
DenizAltunkapan merged 3 commits into
TheAlgorithms:masterfrom
priyanshuvishwakarma273403:fix-7458-unify-dijkstra-priorityqueue

Conversation

@priyanshuvishwakarma273403

Copy link
Copy Markdown
Contributor

Description

This PR unifies the Dijkstra implementation under datastructures/graphs/ to use a single, efficient, priority-queue-based (using Java's PriorityQueue with lazy updates) implementation. It removes the redundant DijkstraOptimizedAlgorithm class.

Related Issue

Fixes #7458

Changes Made

  • Updated DijkstraAlgorithm.java to use a PriorityQueue with $O((V + E) \log V)$ time complexity, utilizing a static inner Node helper class.
  • Removed the redundant DijkstraOptimizedAlgorithm.java and DijkstraOptimizedAlgorithmTest.java.
  • Verified that all robust test cases in DijkstraAlgorithmTest.java run and pass successfully.

Checklist

  • Code compiles successfully.
  • Redundant implementations removed.
  • Unit tests passed.
  • Followed repository code style rules.

@codecov-commenter

codecov-commenter commented Jun 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.88%. Comparing base (0fe06ac) to head (25746ed).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7486      +/-   ##
============================================
- Coverage     79.88%   79.88%   -0.01%     
+ Complexity     7344     7332      -12     
============================================
  Files           809      808       -1     
  Lines         23851    23831      -20     
  Branches       4697     4693       -4     
============================================
- Hits          19054    19037      -17     
+ Misses         4036     4035       -1     
+ Partials        761      759       -2     

☔ 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.

@DenizAltunkapan DenizAltunkapan enabled auto-merge (squash) June 23, 2026 09:51
@DenizAltunkapan DenizAltunkapan merged commit 00339c7 into TheAlgorithms:master Jun 23, 2026
7 checks passed
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

Successfully merging this pull request may close these issues.

Unify Dijkstra on the efficient priority-queue implementation

3 participants