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 level-5 vital article is rated C-class on Wikipedia's content assessment scale. 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 the Uniform-cost search page were merged into Dijkstra's algorithm. For the contribution history and old versions of the redirected page, please see its history; for the discussion at that location, see its talk page. |
The explanation makes no sense
[edit]Under Algorithm 2:
"Assign to every node a distance from start value: for the starting node, it is zero, and for all other nodes, it is infinity, since initially no path is known to these nodes. During execution of the algorithm, the distance of a node N is the length of the shortest path discovered so far between the starting node and N.[17]"
You just assigned INFINITE to ALL. How is the shortest going to be find?
Under 3:
"From the unvisited set, select the current node to be the one with the smallest finite distance; initially, this will be the starting node, which has distance zero. If the unvisited set is empty, or contains only nodes with infinite distance (which are unreachable)"
Again, you assigned infinite to all nodes ...
I stopped reading it here. — Preceding unsigned comment added by 115.70.29.185 (talk) 08:49, 22 October 2024 (UTC)
Description section issues
[edit]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)
- @Zlamma, since you're here, do you have any thoughts about what to do with this 'Description' section? IntGrah (talk) 15:37, 29 May 2024 (UTC)
- Your impression about it being redundant seem justified to me, but I am not very experienced about what should or shouldn't be in an article. For what it's worth, I myself have never read the description when I came to this article to refresh my understanding - going straight to the Algorithm was sufficient, which adds to the redundancy vote, though I am a programmer - perhaps the Algorithm section isn't understandable to all, so maybe waiting for another voice here would make sense.
- Other than this, first thought I had when I saw how that section is written was that maybe that text should go to the 'Simple English' language version of the article (could even give a link to there, above the Plain English 'Algorithm', to make it discoverable). But I can see that version does have a similarly ill-styled text in its Algorithm section already 🙂Zlamma (talk) 00:39, 30 May 2024 (UTC)
- From what I know, Binary search algorithm is the only featured article for an algorithm, and it follows MOS:CS. If binary search, undoubtedly much simpler than Dijkstra, doesn't need a real-life example, I don't think this article needs it either.
- I quite like the idea of incorporating it into simple English; I think the SE article would benefit from the terminology used here: place, road, map. I've not written a simple English before but it is possible. IntGrah (talk) 01:27, 30 May 2024 (UTC)
Algorithm > Pt. 4 (marking a visited) > claim of 'final and minimal'
[edit]Context: Responding to @IntGrah's edit's request to clarify why I feel that point 4 should refer reader to an aspect of point 5.
(Note that this is quite a fine detail of style, so probably not of big interest to most, but my edits were reverted, which suggest it had some importance to IntGrah).
The point 4 and 5 have a bit of a circular dependency which I will show below. Having said that, overall, I still think it's good that they are two separate points, because each information they give provides a new useful insight, but I see just one last fixable problem.
Namely, the claim of "distance recorded on the current node is final and minimal" does not yet follow from what the reader has read so far, especially that so far the reader does not know yet that there is going to be a loop, and how the 'current node' will change. It is only true thanks to the 5th point having "select the one with the smallest known distance" (if the step 5 selected any other node, it would not be true). I feel the insight of "this is the last time we are seeing this node" is helpful though, so I wouldn't remove it, but it would be helpful to admit, that this claim has not yet been justified, and point at where it will be justified, like I tried to do with 'see next step'. Otherwise the reader like me would stop and think they didn't understand something earlier. My new idea is, since @IntGrah points out it's not clear what aspect of step 5 is highlighted, that maybe it should explicitly state something like "(see next steps where the choice of next 'current node' always picks smallest distance)". Zlamma (talk) 12:30, 29 May 2024 (UTC)
- It's important to note that this section is supposed to be a description of the algorithm, not a full fledged proof, so points which are justified inline with the algorithm should be brief. I think that the explanations you've written are a little too long. I understand your concern that the claim "final and minimal" is only justified in the next step; perhaps the earlier steps should deal with written to match the pseudocode more closely?
- Currently, Step 2 says "Set the current node to be the starting node", Step 3 deals with the current node – "For the current node...", and Step 5 deals with the selection of the next node – "select the one with the smallest known distance".
- To better approximate the actual algorithm, would you suggest rewriting Step 3 to be on the lines of "Select the unvisited node with the smallest distance to be the current node", remove the sentence from Step 2, and make Step 5 simply say "Go back to Step 3"?
- With this structure, you could justify the points you made in step 4 much more concisely, rather than long proof sketches which refer to the next step. IntGrah (talk) 12:46, 29 May 2024 (UTC)
- Your suggestions sound sensible to me. (Indeed I was trying to limit myself in the number of points changed, concerned that this would spark contention from many contributors that I would not be able to address, but collaboratively a change like this could be viable.)
- Perhaps I would still add something like I wrote in bold here: "Select the unvisited node with the smallest distance to be the current node (on the first entry to this step, this is the starting node of distance zero)", just to make it easy to think about how the algorithm first engages the state, yet reaffirm that this is a universal instruction that handles all cases. Will leave it up to you though. Zlamma (talk) 13:35, 29 May 2024 (UTC)
- Yes, this is what I had in mind for Step 2. I've incorporated it into the article; feel free to copyedit or point out any other issues with it. IntGrah (talk) 14:10, 29 May 2024 (UTC)
- Thank you. The copy looks good.
- I noticed that you still left no explicit information about justifies the 'finality', which I feel still can be helpful, and I interpret your "With this structure, you could justify the points you made in step 4 much more concisely" as allowing me to add the justification onto the new structure, so I did so already, to cut the conversation short. If you feel strongly that the reader should deduce this themselves, feel free to undo. Zlamma (talk) 15:16, 29 May 2024 (UTC)
- Your explanation looks fine to me. Thank you. IntGrah (talk) 15:27, 29 May 2024 (UTC)
- Yes, this is what I had in mind for Step 2. I've incorporated it into the article; feel free to copyedit or point out any other issues with it. IntGrah (talk) 14:10, 29 May 2024 (UTC)
Add A Fact: "Dijkstra's algorithm proven universally optimal"
[edit]I found a fact that might belong in this article. See the quote below
Dijkstra’s algorithm was long thought to be the most efficient way to find a graph’s best routes. Researchers have now proved that it’s “universally optimal.”
The fact comes from the following source:
Here is a wikitext snippet to use as a reference:
{{Cite web |title=Computer Scientists Establish the Best Way to Traverse a Graph |url=https://www.quantamagazine.org/computer-scientists-establish-the-best-way-to-traverse-a-graph-20241025/ |website=Quanta Magazine |date=2024-10-25 |access-date=2024-11-17 |language=en |first=Ben |last=Brubaker |quote=Dijkstra’s algorithm was long thought to be the most efficient way to find a graph’s best routes. Researchers have now proved that it’s “universally optimal.”}}
Perhaps it should also be noted in: https://wiki.riteme.site/wiki/Shortest_path_problem
This post was generated using the Add A Fact browser extension.
DKEdwards (talk) 18:37, 17 November 2024 (UTC)
- What it actually means is that if
- what you really want is the sorted order of vertices by distance from the source and not just the distances and paths,
- you know ahead of time what graph you're going to run it on but not the weights, and
- you can only access the weights by pairwise comparisons,
- then a specific version of Dijkstra (with a special priority queue) will get a number of comparisons within a constant factor of optimal. It's a nice result, and probably should be mentioned in this article (Dijkstra's algorithm) but I question the relevance to shortest path problem because it's about sorting rather than shortest paths per se. It may have been a bit oversold by Quanta. —David Eppstein (talk) 21:14, 17 November 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