-- May 1 In-Class Exercise
there are 6 edges:
lengths are 3,4,5, 5, 6, 7. Triangle inequality requires that sum of any two edges' lengths >= any other edge. In our case, two shortest edges' length sum = 3+4 = 7 >= 5,6,7, let alone when edge lengths increase from here. hence triangle inequality holds.
Initially, Q = {(1, inf), (2, inf), (3, inf), (4, inf) } , randomly choose 1 as root, update Q to
Q = {(1, 0), (2, inf), (3, inf), (4, inf) }, remove 1 from Q, updated Q = { (2, 3), (3, 4), (4, 5)}, update Q = { (3,4), (4,5)} since no weights updated for 3 and 4. Remove 3 and Q = {(4,5)}.
So the tree looks like 1 ( root) - 2 (left child) - 3 (middle child) - 4( right child), so post order traverse is 2-3-4-1.
there are 6 edges:
lengths are 3,4,5, 5, 6, 7. Triangle inequality requires that sum of any two edges' lengths >= any other edge. In our case, two shortest edges' length sum = 3+4 = 7 >= 5,6,7, let alone when edge lengths increase from here. hence triangle inequality holds.
Initially, Q = {(1, inf), (2, inf), (3, inf), (4, inf) } , randomly choose 1 as root, update Q to
Q = {(1, 0), (2, inf), (3, inf), (4, inf) }, remove 1 from Q, updated Q = { (2, 3), (3, 4), (4, 5)}, update Q = { (3,4), (4,5)} since no weights updated for 3 and 4. Remove 3 and Q = {(4,5)}.
So the tree looks like 1 ( root) - 2 (left child) - 3 (middle child) - 4( right child), so post order traverse is 2-3-4-1.