10.6 Shortest-Path Problems Flashcards

1
Q

Weighted Graphs :

length in these graphs:

A

Graphs that have a number assigned to each edge are called weighted graphs.

Length of a path in a weighted graph be the sum of the weights of the edges of this path.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Theory of Dijkstra’s Algorithm.

Do the example to get the hang of it.

A

..

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

ALGORITHM 1 Dijkstra’s Algorithm.

A

procedure Dijkstra(G: weighted connected simple graph, with
all weights positive)
{G has vertices a = v0, v1,… , vn = z and lengths w(vi, vj ) where w(vi, vj ) = ∞ if {vi , vj } is not an edge in G}
for i := 1 to n
L(vi) := ∞
L(a) := 0
S := ∅
{the labels are now initialized so that the label of a is 0 and all other labels are ∞, and S is the empty set}
while z ∉ S
u := a vertex not in S with L(u) minimal
S := S ∪ {u}
for all vertices v not in S
if L(u) + w(u, v) < L(v) then L(v) := L(u) + w(u, v)
{this adds a vertex to S with minimal label and
updates the labels of vertices not in S}
return L(z) {L(z) = length of a shortest path from a to z}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

show that this
algorithm always produces the length of a shortest path between two vertices in a weighted
graph:

Theorem 1:

A
Next, we use an inductive argument to show that Dijkstra’s algorithm produces the length
of a shortest path between two vertices a and z in an undirected connected weighted graph. Take
as the inductive hypothesis the following assertion: At the kth iteration
(i ) the label of every vertex v in S is the length of a shortest path from a to this vertex, and
(ii ) the label of every vertex not in S is the length of a shortest path from a to this vertex that
contains only (besides the vertex itself) vertices in S

THM:
Dijkstra’s algorithm finds the length of a shortest path between two vertices in a connected
simple undirected weighted graph.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

computational complexity of Dijkstra’s algorithm :

A

Dijkstra’s algorithm uses O(n2) operations (additions and comparisons) to find the length of
a shortest path between two vertices in a connected simple undirected weighted graph with n
vertices.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Travelling Salesperson Problem:

Problem Statement:
and what it means.

A

The traveling salesperson problem asks for the circuit of minimum total weight in a weighted, complete, undirected
graph that visits each vertex exactly once and returns to its starting point.

This is equivalent to
asking for a Hamilton circuit with minimum total weight in the complete graph, because each
vertex is visited exactly once in the circuit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Solution to TSP :

A

Need to examine (n − 1)!∕2 circuits to find ans.
So, use approximation algorithm.
That is, they may produce a Hamilton circuit with total weight W′ such that
W ≤ W′ ≤ cW, where W is the total length of an exact solution and c is a constant.
For example,
there is an algorithm with polynomial worst-case time complexity that works if the weighted
graph satisfies the triangle inequality such that c = 3∕2. For general weighted graphs for every
positive real number k no algorithm is known that will always produce a solution at most k times
a best solution. If such an algorithm existed, this would show that the class P would be the same
as the class NP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly