weighted graph and Dijkstras algorithm