23.1-4 A triangle whose edge weights are all equal is a graph in
Transcription
23.1-4 A triangle whose edge weights are all equal is a graph in
23.1-4 A triangle whose edge weights are all equal is a graph in which every edge is a light edge crossing some cut. But the triangle is cyclic, so it is not a minimum spanning tree. 24-3 (a) You can first convert the inequality 𝑅[𝑖1 , 𝑖2 ] ∙ 𝑅[𝑖2 , 𝑖3 ] ∙∙∙ 𝑅[𝑖𝑘−1 , 𝑖𝑘 ] ∙ 𝑅[𝑖𝑘 , 𝑖1 ] > 1 into (− log 𝑅[𝑖1 , 𝑖2 ]) + (− log 𝑅[𝑖2 , 𝑖3 ]) + ⋯ + (− log 𝑅[𝑖𝑘−1 , 𝑖𝑘 ]) + (− log 𝑅[𝑖𝑘 , 𝑖1 ]) < 0 , and then apply the BELLMAN-FORD algorithm in textbook to find the existence of negative cycle (i.e., the Arbitrage). Since there are 𝑛2 edges for table 𝑅 , the time complexity can calculate as 𝑂(|𝑉||𝐸|) = 𝑂(𝑛3 ). (b) After doing BELLMAN-FORD to solve part (a), we go through the edges once again. Once we find an edge (u, v) for which d(v) > d(u) + ω(u, v) . We can trace back the parent nodes starting from vertex u until we get back to 𝑢 , and all vertices in between will constitute a negative-weight cycle. The overall time complexity still stays at O(n3 ).