Talk:Dijkstra's algorithm

From WikiProjectMed
Jump to navigation Jump to search

Description section issues

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)[reply]

@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)[reply]
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)[reply]
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)[reply]

Algorithm > Pt. 4 (marking a visited) > claim of 'final and minimal'

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)[reply]

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)[reply]
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)[reply]
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)[reply]
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)[reply]
Your explanation looks fine to me. Thank you. IntGrah (talk) 15:27, 29 May 2024 (UTC)[reply]