A Bit of Mathematics
Note that a min-priority queue uses a non-decreasing list of numbers to prioritize vertices. That is, if two vertices have same key, then one of them is chosen at random. In other words, the algorithm depends entirely on the ordering of integers, about which we study in Lattice theory (does words like poset/toset ring a bell?).
Try running the algorithm on the following graph:

After Round 1 of Loop execution, which vertex will you choose next? Run it choosing y first and then t. Do we get the correct result?
Pages: Contents … << Previous 12 Next Page>>
One Comment Add yours