Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For any weighted graph G = ( V , E , w ) and integer k , define Gk to be the graph that results
For any weighted graph G V Ew and integer k define Gk to be the graph that results fromremoving every edge in G having weight k or larger.Given a connected undirected weighted graph G V Ew where every edge has a uniqueinteger weight, describe an OE log Etime algorithm to determine the largest value of k suchthat Gk is not connected.Solution: Construct an array A containing the E distinct edge weights in G and sort it inOE log E time, eg using merge sort. We will binary search to find k Specifically, consideran edge weight k in A initially the median edge weight and run a reachability algorithm egFullBFS or FullDFS to compute the reachability of an arbitrary vertex x V in OE time.If exactly V vertices are reachable from x then Gk is connected and k k; recurse on strictlylarger values for k Otherwise, Gk is not connected, so k k; recurse on nonstrictly smallervalues for k By dividing the search range by a constant fraction at each step ie by alwayschoosing the median index weight of the unsearched space binary search will terminate afterOlog E steps, identifying the largest value of k such that Gk is not connected. This algorithmtakes OE log E time to sort, and computes reachability of a vertex in OE time, Olog Etimes so this algorithm runs in OE log E time in total. Give an example.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started