Diagrams are wrong for Prim's algorithm (8.22)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- documentation
Research direction
Start by locating the Prim's algorithm material identified as section 8.22 and compare the diagram after the second iteration with the issue's expected d values. Update the diagram so C, D, and E show the edge weights from B rather than accumulated Dijkstra-style values. Confirm the corrected labels match the stated values and diagram state.
Written by the indexing model from the issue text.
Description
The following is the diagram for Prim's algorithm after the second iteration (i.e, node B has been removed from the priority queue and added to the MST).

The d values inside the nodes in the above diagram seem to come from adding the d value of node B to the corresponding edge weights (like in Dijkstra's algorithm)
d[D] = d[B] + 1 = 2 + 1 = 3
d[E] = d[B] + 4 = 2 + 4 = 6
which is wrong. Instead, the d values of nodes C, D and E should be just the edge weights from B.
d[C] = weight(B, E) = 1 // Was earlier 3
d[D] = weight(B, D) = 1 // Was earlier ∞
d[E] = weight(B, E) = 4 // Was earlier ∞
@bnmnetp
- Dominant language
- Python
- Stars
- 273
- Forks
- 160
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from RunestoneInteractive/pythonds
-
Difficulty 1/5 Under an hour Newbie friendliness 70/100
RunestoneInteractive/pythonds#109 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
RunestoneInteractive/pythonds#126 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 52/100
RunestoneInteractive/pythonds#120 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 55/100
RunestoneInteractive/pythonds#103 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 38/100
RunestoneInteractive/pythonds#96 · 1 comment ·
All issues in RunestoneInteractive/pythonds
Similar issues
-
triage/confirmed
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
agentscope-ai/agentscope#2775 ·
-
comp/desktop P3 type/bug
Difficulty 1/5 Under an hour Newbie friendliness 92/100
NousResearch/hermes-agent#118866 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
apache/cloudstack#14222 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100