Potential Inefficiency and Missed Priority Updates in Dijkstra's Algorithm Implementation
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
- Ambito
- data
Direzione di ricerca
Locate the Dijkstra implementation and the PriorityQueue implementation, then inspect how hasValue, changePriority, and duplicate entries behave. Add or update coverage for a shorter path when the neighbor is absent or already present, and confirm the queue preserves the intended priority without duplicates.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
In the Dijkstra algorithm, when a shorter path to a neighbor is found, the neighbor's priority in the priority queue should be updated regardless of whether it is already present in the queue.
In this code, the priority is only changed if queue.hasValue(neighbor) returns true. However, if a neighbor is not yet in the queue, it is added; but if it's already present, the code changes its priority.
This logic is correct as long as queue.changePriority works as intended, but it could be fragile if there are issues in the PriorityQueue implementation (such as not truly updating priorities or not handling duplicates). If the PriorityQueue does not remove duplicates, a neighbor may exist multiple times in the queue with different priorities.
- Lingua principale
- JavaScript
- Stelle
- 197k
- Fork
- 31k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di trekhleb/javascript-algorithms
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
trekhleb/javascript-algorithms#2102 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
trekhleb/javascript-algorithms#2085 · 6 commenti · 1 reazione ·
-
LinkedList methods. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
trekhleb/javascript-algorithms#2065 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
trekhleb/javascript-algorithms#2057 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
trekhleb/javascript-algorithms#2048 · 2 commenti · 2 reazioni ·
Tutte le issue di trekhleb/javascript-algorithms
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
avniproject/avni-client#2135 ·
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
babalae/bettergi-scripts-list#3674 ·
-
A-Release-Notes C-Editing D-Modest S-Ready-For-Implementation
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
bevyengine/bevy-website#2595 ·
-
ecosystem wording
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
matrix-org/matrix.org#3649 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
vadimdemedes/ink#1029 ·