reneargento/algorithms-sedgewick-wayne

4.4.10

kyzooghost opened this issue · 3 comments

Consider the edges in the digraph defined in Exercise 4.4.4 to be undirected edges such that each edge corresponds to equal-weight edges in both directions in the edge-weighted digraph. Answer Exercise 4.4.6 for this corresponding edge-weighted digraph.

Not all edges have been included, including 0->6 0.58

The complete list of edges then is:

4->5 0.35
5->4 0.35
5->1 0.32
1->5 0.32
0->4 0.38
4->0 0.38
0->2 0.26
2->0 0.26
1->3 0.29
3->1 0.29
6->2 0.40
2->6 0.40
3->6 0.52
6->3 0.52
6->0 0.58
0->6 0.58
6->4 0.93
4->6 0.93

In your solution you've begun with adding 0->2 0.26 and 0->4 0.38 to the SPT.

You next add 6->2 0.40 such that distTo[6] = 0.66.

Instead 0->6 0.58 should be added to the SPT such that distTo[6] = 0.58.

That is right, the edge 0->6 was missing.
It is now added here: 79b8a71
Thanks for the contribution!

Pleasure 👍

And an extra thanks for becoming a sponsor to this repository ❤️