Bellman Ford Algorithm for Single Source Shortest Paths Flashcards

1
Q

What problem does the Bellman-Ford algorithm solve?

A

The single-source shortest path problem, even with negative edge weights.

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

What is the core operation of the Bellman-Ford algorithm?

A

Edge relaxation: if d[u] + w(u,v) < d[v], then update d[v] and π[v].

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

How are distances initialized in Bellman-Ford?

A

d[source] = 0; d[v] = ∞ for all other vertices; π[v] = NIL.

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

What is the time complexity of Bellman-Ford?

A

Θ(V * E), where V is number of vertices and E is number of edges.

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

How many times does Bellman-Ford relax each edge?

A

At most |V| - 1 times.

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

What condition signals a negative-weight cycle in Bellman-Ford?

A

If any edge can still be relaxed after |V| - 1 iterations.

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

What does the parent pointer π[v] track in Bellman-Ford?

A

The vertex u that provides the shortest path to v via edge (u,v).

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

What is the Monotonicity Property of Bellman-Ford?

A

At all times, d[v] ≥ δ(s, v), where δ(s,v) is the true shortest path length.

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

After how many iterations are all shortest paths guaranteed (if no negative cycle)?

A

After |V| - 1 iterations.

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

What does it mean to ‘relax’ an edge (u,v)?

A

Check if d[u] + w(u,v) < d[v]; if so, update d[v] and π[v].

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

What property ensures that Bellman-Ford’s estimate d[v] always reflects a real path?

A

Existence Property: if d[v] ≠ ∞, then there exists a path from s to v of that length.

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

What is the behavior of Bellman-Ford in the presence of a negative-weight cycle?

A

It detects the cycle and declares shortest paths are undefined.

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

What are the three main steps in Bellman-Ford?

A
  1. Initialize distances, 2. Relax all edges |V|-1 times, 3. Check for negative cycles.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly