-
-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Diagrams are wrong for Prim's algorithm (8.22) #99
Comments
No. |
Hi @bnmnetp , sorry if I'm missing something obvious here. Can you please help me understand how I traced the code for the graph provided in the book and the following is the trace I got. At no point does it set d[E] = 6. I'm a bit confused.
|
@yasinovskyy we should fix this before the print edition goes to print. |
@tylerpar99 currently working on this issue. |
Will be fixed once I submit a PR with all the other updates. Here is the final version of the graph after running Prim's. Thanks @varunbpatil for pointing this out. |
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 thed
value of nodeB
to the corresponding edge weights (like in Dijkstra's algorithm)which is wrong. Instead, the
d
values of nodesC
,D
andE
should be just the edge weights fromB
.@bnmnetp
The text was updated successfully, but these errors were encountered: