dist1
and dist2
, to store the distances from node1
and node2
to all other nodes, respectively, with large initial values.node1
to fill dist1
with the shortest distances to all nodes.node2
to fill dist2
with the shortest distances to all nodes.minDistNode
to -1
and minDistTillNow
to a large value.node1
and node2
.minDistNode
and minDistTillNow
accordingly during the iteration.minDistNode
as the result.