added shortest distance in weighted graph