Question: Let G = (V, E) be a connected undirected graph. We define the risk factor of a vertex u as the number of pairs
Let G = (V, E) be a connected undirected graph. We define the risk factor of a vertex u as the number of pairs of vertices that cannot reach one another after removing u from G; more formally, risk factor of u = {(x,y) EV-ux V-u : #x-y path in G[V u]}|. For example, in the following graph u has risk factor 6 because removing u disconnects the graph into two connected components having 2 and 3 nodes respectively. U Design an algorithm that computes the risk factor of a given vertex u in O(n + m) time. Remember to: a) describe your algorithm in plain English, b) prove it correctness, and c) analyze its time complexity. To get full marks your algorithm must run in O(n + m) time. If you cannot make the stated bound, you can get partial credit by submitting a slower algorithm.
Step by Step Solution
3.40 Rating (163 Votes )
There are 3 Steps involved in it
a Algorithm in Plain English Create an empty set called unreachablepairs Traverse all vertices connected to the vertex u and remove each one of them f... View full answer
Get step-by-step solutions from verified subject matter experts
