Dijkstra's algorithm: Difference between revisions

Content deleted Content added
Dysprosia (talk | contribs)
m disambig link, doesn't link properly
m must have open-interval bracket for infinity
Line 3:
<b>Dijkstra's algorithm</b>, named after its inventor the Dutch [[computer scientist]] [[Edsger Dijkstra]], solves a [[shortest path problem]] for a directed and connected [[graph theory|graph]] G(V,E) which has nonnegative (>=0) [[edge]] weights. The set V is the set of all [[vertex|vertices]] in the graph G. The set E is the set of ordered pairs which represent connected vertices in the graph (if (u,v) belongs to E then there is a connection from vertex u to vertex v).
 
Assume that the function w: V x V -> [0, &infin;]) describes the cost w(x,y) of moving from vertex x to [[vertex]] y (non-negative cost). (We can define the
cost to be infinite for pairs of vertices that are not connected by an edge.)
The cost of a path between two vertices is the sum of costs of the edges in that path. The cost of an edge can be thought of as (a generalisation of) the distance between those two vertices. For a given pair of vertices s,t in V, the algorithm finds the path from s to t with lowest cost (i.e. the shortest path).