Summary COMPREHENSIVE NOTES ON DIJKSTRA'S ALGORITHM
10 keer bekeken 0 keer verkocht
Vak
Unit 3 - Fundamentals of algorithms
Instelling
AQA
Includes enough information for A-level students and degree level students, comprehensive notes on Dijkstra's shortest-path algorithm | A-level content | A* Revision
1 Theory
1.1 Relaxation
Dijkstra’s algorithm uses the technique of relaxation. For each vertex v ∈ V
in the graph G = (V, E), we maintain an attribute v.d which represents the
upper bound on the weight of a shortest path from source s to v, thus it is a
shortest-path estimate. Also for each vertex v we maintain a predecessor
v.π that is either another vertex or null.
A pseudocode implementation of the algorithm to initialise the shortest-path
estimates and predecessors is given below:
1 initialise_source(G, s)
2 for each vertex v in G.V
3 v.d = infinity
4 v.pi = null
5 s.d = 0
This initialises v.π = for all v ∈ V , s.d = 0, and v.d = inf for v ∈ V − s
Relaxing an edge (u, v) consists of testing if the shortest path to v found so
far can be improved by going through u. If so, v.d and v.π can be updated,
more specifically a decrease in the shortest-path estimate and subsequent up-
dates to v’s predecessor attribute.
A pseudocode implementation of the algorithm to perform one relaxation step
on an edge (u, v) is given as follows:
1.2 Dijkstra’s algorithm
Dijkstra’s algorithm solves the single-source shortest-paths problem on a weighted,
directed graph for the case that all edge weights are non-negative.
G = (V, E), w(u, v) ≥ 0 for each edge (u, v) ∈ E
A set S of vertices is maintained whose final shortest-path weights from the
source s have already been determined
The vertex u ∈ V − S is repeatedly selected with the shortest-path estimate,
adds u to S, and relaxes all edges leaving u
A pseudocode implementation is given below:
1
Voordelen van het kopen van samenvattingen bij Stuvia op een rij:
Verzekerd van kwaliteit door reviews
Stuvia-klanten hebben meer dan 700.000 samenvattingen beoordeeld. Zo weet je zeker dat je de beste documenten koopt!
Snel en makkelijk kopen
Je betaalt supersnel en eenmalig met iDeal, creditcard of Stuvia-tegoed voor de samenvatting. Zonder lidmaatschap.
Focus op de essentie
Samenvattingen worden geschreven voor en door anderen. Daarom zijn de samenvattingen altijd betrouwbaar en actueel. Zo kom je snel tot de kern!
Veelgestelde vragen
Wat krijg ik als ik dit document koop?
Je krijgt een PDF, die direct beschikbaar is na je aankoop. Het gekochte document is altijd, overal en oneindig toegankelijk via je profiel.
Tevredenheidsgarantie: hoe werkt dat?
Onze tevredenheidsgarantie zorgt ervoor dat je altijd een studiedocument vindt dat goed bij je past. Je vult een formulier in en onze klantenservice regelt de rest.
Van wie koop ik deze samenvatting?
Stuvia is een marktplaats, je koop dit document dus niet van ons, maar van verkoper riley4. Stuvia faciliteert de betaling aan de verkoper.
Zit ik meteen vast aan een abonnement?
Nee, je koopt alleen deze samenvatting voor €7,75. Je zit daarna nergens aan vast.