Talk:Dijkstra's algorithm
This is the talk page for discussing improvements to the Dijkstra's algorithm article. This is not a forum for general discussion of the article's subject. |
Article policies
|
Find sources: Google (books · news · scholar · free images · WP refs) · FENS · JSTOR · TWL |
Archives: 1, 2Auto-archiving period: 12 months ![]() |
![]() | This ![]() It is of interest to the following WikiProjects: | |||||||||||||||||||||||||||||||||||||
|
|
||
This page has archives. Sections older than 365 days may be automatically archived by Lowercase sigmabot III when more than 4 sections are present. |
![]() | The contents of Uniform-cost search was merged into Dijkstra's algorithm. The former page's history now serves to provide attribution for that content in the latter page, and it must not be deleted as long as the latter page exists. For the discussion at that location, see its talk page. |
Is there a typo in the "Invariant hyphothesis" sentence?
It says: "This assumption is only considered if a path not exists," but should it be "This assumption is only considered if a path exists," ?
Pseudocode improvement
In first pseudocode block, on line 15, dist[u] is checked for not being INFINITY. But if it is INFINITY at this point, the code will continue useless looping, because all remaining vertices will also have dist[u]=INFINITY and not influence the result. Maybe move the INFINITY check to line 11 and break out of while block, it would be more human readable too I think --Shrddr (talk) 20:44, 20 August 2022 (UTC)
We should stick to sources rather than commit WP:OR. CLRS has
DIJKSTRA(G, w, s) // Graph G, weights w, source vertex s 1 INITIALIZE-SINGLE-SOURCE(G, s) // lines 3-5 of our algorithm 2 S = 0 // empty set 3 Q = G.V // line 6 4 while Q non empty 5 u = EXTRACT-MIN(Q) // line 10, 11 6 S = S union {u} 7 for each vertex v in G:Adj(u) // slightly different to ours 8 RELAX(u,v,w)
where RELAX is
RELAX(u, v, w) 1 if v.dist > u.dist + w(u, v) 2 v.dist = u.dist + w(u, v) 3 v.prev = u
There is nothing in this algorithm with a test of u.dist being infinity. So I think its safe to remove the condition entirely. --Salix alba (talk): 10:44, 21 August 2022 (UTC)
- The text before pseudocode box ends with reference to https://doi.org/10.1007%2F978-3-540-77978-0 which does mention infinity check (see "algorithm" at page 197). But then for some reason it's left out in "pseudocode" at page 198. Shrddr (talk) 12:51, 21 August 2022 (UTC)
Pseudocode is wrong
The pseudocode that uses a priority queue is plain wrong, it produces garbage. I used this instead and can confirm it works okay: https://stackabuse.com/courses/graphs-in-python-theory-and-implementation/lessons/dijkstras-algorithm/ WhyYouAskMe (talk) 11:25, 4 September 2022 (UTC)
Distracting animation
This article contains an infinitely looping animation which is placed right next to the text, and cannot be stopped. This is extremely distracting while reading, and can be a significant problem for some readers. I strongly suggest changing this so that the animation would only run on demand. BarroColorado (talk) 11:33, 22 September 2022 (UTC)
Proof of correctness is incomprehensible
This section is full of grammar issues that make it very difficult to understand. Maybe it should be rewritten. Indicere (talk) 03:10, 28 January 2023 (UTC)
Description section
The section currently titled 'description' reads more like a tutorial on how to run Dijkstra by hand. It's full of second person and even tells you to use a pencil and follow along. Aside from that, it's just a complete restatement of the 'Algorithm' section, except in the context of city roads, jargon removed. It is of course necessary to provide an explanation that can be understood by the general reader, but this is redundant and not the way to do it. IntGrah (talk) 22:33, 26 April 2024 (UTC)
- C-Class level-5 vital articles
- Wikipedia level-5 vital articles in Mathematics
- C-Class vital articles in Mathematics
- C-Class Computer science articles
- Top-importance Computer science articles
- WikiProject Computer science articles
- C-Class mathematics articles
- Mid-priority mathematics articles
- C-Class Computing articles
- High-importance Computing articles
- All Computing articles