mstUB function

Shortest Path Upper Bound