- #1
SadPaul
- 2
- 0
- Homework Statement
- Let G = (N1 U N2, A) be a bipartite directed network. Suppose that n1 = |N1|, n2 = |N2|
and n1 < n2. Show that the Bellman Ford algorithm solves the shortest path
problem in this network in O(n1m) time.
- Relevant Equations
- -
Hey guys, I need a little help with this exercise so I know I'm on the right path.
My explanation:
The Bellman-Ford-Moore algorithm computes shortest paths in O(nm) time, so in this situation we say that in a directed bipartite graph the number of iterations that the algorithm will do is min{n1, n2} + 1 = n1 + 1 and the algorithm takes O(m) time per iteration, so the final time is O(n1m).
So far so good, but I' m not really certain if I compute the number of iterations correctly, or how to explain it better.
Any usefull ideas would be welcome!
My explanation:
The Bellman-Ford-Moore algorithm computes shortest paths in O(nm) time, so in this situation we say that in a directed bipartite graph the number of iterations that the algorithm will do is min{n1, n2} + 1 = n1 + 1 and the algorithm takes O(m) time per iteration, so the final time is O(n1m).
So far so good, but I' m not really certain if I compute the number of iterations correctly, or how to explain it better.
Any usefull ideas would be welcome!