Djikstra Min Distance implementation