Skip to content

refactor: unify Dijkstra on efficient PriorityQueue implementation#7486

Open
priyanshuvishwakarma273403 wants to merge 2 commits into
TheAlgorithms:masterfrom
priyanshuvishwakarma273403:fix-7458-unify-dijkstra-priorityqueue
Open

refactor: unify Dijkstra on efficient PriorityQueue implementation#7486
priyanshuvishwakarma273403 wants to merge 2 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

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.85%. Comparing base (631eae3) to head (3e0d6b9).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7486      +/-   ##
============================================
- Coverage     79.86%   79.85%   -0.02%     
+ Complexity     7333     7321      -12     
============================================
  Files           808      807       -1     
  Lines         23833    23813      -20     
  Branches       4690     4686       -4     
============================================
- Hits          19035    19016      -19     
  Misses         4036     4036              
+ Partials        762      761       -1     

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

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

2 participants