SSSP - Bellman-Ford Flashcards

1
Q

Works with Negative weight

A

yes

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

Time complexity

A

O(V*E) as we repeat V-1 times all edges

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

Relax all edges by V-1 times

A

w(u) + w(u-v) <= w(v) then update with new weight

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

Total number of edges in complete graph N

A

[n(n-1)]/2

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

Set source vertex 0 and rest all as INFINITY

A

use relax method V-1 times

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

Time complexity for complete graph

A

(nn-1/2) * (n-1)
n-1 nodes
(n
nā€“1) / 2 edges
o(n)^3

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

Will not work with Cycle with Negative weights

A

It will work for positive. But not for negative cycles
Normally weights will not change after V-1 times. But if changes then we have negative weight cycles

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

How it works

A

Usually given source vertex, order of edges and number of passes.
If source vertex is not given then pick one run by keeping every edge as INFINITY and source 0
And repeat this with N-1 times
https://www.youtube.com/watch?v=FtN3BYH2Zes

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