Dijkstra's algorithm - Wikipedia, the free encyclopedia

Dijkstra's algorithm - Wikipedia, the free encyclopedia -...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Dijkstra's algorithm - Wikipedia, the free encyclopedia http://en.wikipedia.org/wiki/Dijkstra's_algorithm 1 of 4 12/13/2006 2:00 PM Graph search algorithms Search A* Bellman-Ford algorithm Best-first search Bidirectional search Breadth-first search Depth-first search Depth-limited search Dijkstra's algorithm Floyd-Warshall algorithm Iterative deepening depth-first search Johnson's algorithm Uniform-cost search Dijkstra's algorithm From Wikipedia, the free encyclopedia Dijkstra's algorithm , named after its discoverer, Dutch computer scientist Edsger Dijkstra, is a greedy algorithm that solves the single-source shortest path problem for a directed graph with nonnegative edge weights. For example, if the vertices of the graph represent cities and edge weights represent driving distances between pairs of cities connected by a direct road, Dijkstra's algorithm can be used to find the shortest route between two cities. The input of the algorithm consists of a weighted directed graph G and a source vertex s in G . We will denote V the set of all vertices in the graph G . Each edge of the graph is an ordered pair of vertices ( u , v ) representing a connection from vertex u to vertex v . The set of all edges is denoted E . Weights of edges are given by a weight function w : E [0, ); therefore w ( u , v ) is the non-negative cost of moving directly from vertex u to vertex v . The cost of an edge can be thought of as (a generalization of) the distance between those two vertices. The cost of a path between two vertices is the sum of costs of the edges in that path. For a given pair of vertices s and t in V , the algorithm finds the path from s to t with lowest cost (i.e. the shortest path). It can also be used for finding costs of shortest paths from a single vertex s to all other vertices in the graph. Contents 1 Description of the algorithm 2 Pseudocode 3 Running time 4 Related problems and algorithms 5 References 6 See also 7 External links Description of the algorithm
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Dijkstra's algorithm - Wikipedia, the free encyclopedia http://en.wikipedia.org/wiki/Dijkstra's_algorithm 2 of 4 12/13/2006 2:00 PM The algorithm works by keeping for each vertex v the cost d [ v ] of the shortest path found so far between s and v . Initially, this value is 0 for the source vertex s ( d [ s ]=0), and infinity for all other vertices, representing the fact that we do not know any path leading to those vertices ( d [ v ]= for every v in V , except s ). When the algorithm finishes, d [ v ] will be the cost of the shortest path from s to v — or infinity, if no such path exists. The basic operation of Dijkstra's algorithm is
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

Dijkstra's algorithm - Wikipedia, the free encyclopedia -...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online