- #1
evinda
Gold Member
MHB
- 3,836
- 0
Hello!
We have a directed graph [tex] G=(V,E) [/tex],at which each edge [tex](u, v) \in E[/tex] has a relative value [tex]r(u, v) \in R[/tex] and [tex]0 \leq r(u, v) \leq 1[/tex], that repsesents the reliability , at a communication channel, from the vertex [tex]u[/tex] to the vertex [tex]v[/tex]. Consider as [tex]r(u, v)[/tex] the probability that the chanel from [tex]u[/tex] to [tex]v[/tex] will not fail the transfer and that the probabilities are independent.
I want to write an efficient algorithm that finds the most reliable path between two given nodes.
I have tried the following:
and I wanted to find the complexity of the algorithm.
The time complexity of INITIALIZE-SINGLE-SOURCE(G,s) is O(|V|).
The time complexity of the line 4 is O(1).
The time complexity of the line 5 is O(|V|).
The time complexity of the line 7 is O(log(|V|)).
The time complexity of the line 8 is O(1).
Which is the time complexityof the command S<-S U {u} ?
The line 10 is executed in total [tex] O(\sum_{v \in V} deg(v))=O(E) [/tex] times and the time complexity of RELAX is O(1).So the time complexity of the algorithm is equal to the time complexity of the lines (3-9)+O(E).
Which is the time complexity of the union?
We have a directed graph [tex] G=(V,E) [/tex],at which each edge [tex](u, v) \in E[/tex] has a relative value [tex]r(u, v) \in R[/tex] and [tex]0 \leq r(u, v) \leq 1[/tex], that repsesents the reliability , at a communication channel, from the vertex [tex]u[/tex] to the vertex [tex]v[/tex]. Consider as [tex]r(u, v)[/tex] the probability that the chanel from [tex]u[/tex] to [tex]v[/tex] will not fail the transfer and that the probabilities are independent.
I want to write an efficient algorithm that finds the most reliable path between two given nodes.
I have tried the following:
Code:
DIJKSTRA(G,w,s,t)
INITIALIZE-SINGLE-SOURCE(G,s)
S=Ø
Q=G.V
while Q != Ø
u<-EXTRACT-MAX(Q)
if (u=t) return d[t]
S<-S U {u}
for each vertex v in G.Adj[u]
RELAX(u,v,w)INITIAL-SINGLE-SOURCE(G,s)
for each vertex v in V.G
d[v]=-inf
pi[v]=NIL
d[s]=0
RELAX(u,v,w)
if d[v]<d[u]*w(u,v)
d[v]<-d[u]*w(u,v)
pi[v]<-u
and I wanted to find the complexity of the algorithm.
The time complexity of INITIALIZE-SINGLE-SOURCE(G,s) is O(|V|).
The time complexity of the line 4 is O(1).
The time complexity of the line 5 is O(|V|).
The time complexity of the line 7 is O(log(|V|)).
The time complexity of the line 8 is O(1).
Which is the time complexityof the command S<-S U {u} ?
The line 10 is executed in total [tex] O(\sum_{v \in V} deg(v))=O(E) [/tex] times and the time complexity of RELAX is O(1).So the time complexity of the algorithm is equal to the time complexity of the lines (3-9)+O(E).
Which is the time complexity of the union?