Take a look at Dijkstra's algorithm:
Dijkstra's algorithm, conceived by the Dutch scientist and programmer Edsger Dijkstra in 1956 and published in 1959, is a graph search algorithm that solves the shortest path problem of a single source for a graph with non-negative costs for edge paths, creating the shortest path tree. This algorithm is often used in routing and as a subroutine in other graph algorithms.
http://en.wikipedia.org/wiki/Dijkstra 's_algorithm
source share