Chapter 5: Q4E (page 161)
Show that if an undirected graph with n vertices has k connected components, then it has at least n - k edges.
Short Answer
The undirected graph with n vertices has k connected components with least n - k edges.
Chapter 5: Q4E (page 161)
Show that if an undirected graph with n vertices has k connected components, then it has at least n - k edges.
The undirected graph with n vertices has k connected components with least n - k edges.
All the tools & learning materials you need for study success - in one app.
Get started for freeGive the state of the disjoint-sets data structure after the following sequence of operations, starting from singleton sets . Usepath compression. In the case of ties, always make the lower numbered root point to the higher numbered ones.
Graphs with prescribed degree sequences. Given a list of n positive integers , we want to efficiently determine whether there exists an undirected graph whose nodes have degrees precisely . That is, if , then the degree of should be exactly . We call the degree sequence of . This graph should not contain self-loops (edges with both endpoints equal to the same node) or multiple edges between the same pair of nodes.
(a) Give an example of where all the and is even, but for which no graph with degree sequence exists.
(b) Suppose that and that there exists a graph with degree sequence . We want to show that there must exist a graph that has this degree sequence and where in addition the neighbors of are . The idea is to gradually transform into a graph with the desired additional property.
i. Suppose the neighbors of in are not . Show that there exists and and such that and
ii. Specify the changes you would make to to obtain a new graph with the same degree sequence as and where .
iii. Now show that there must be a graph with the given degree sequence but in which has neighbors .
c) Using the result from part (b), describe an algorithm that on input (not necessarily sorted) decides whether there exists a graph with this degree sequence. Your algorithm should run in time polynomial in and in .
In this problem, we will develop a new algorithm for finding minimum spanning trees. It is based upon the following property:
Pick any cycle in the graph, and let e be the heaviest edge in that cycle. Then there is a minimum spanning tree that does not contain e.
(a) Prove this property carefully.
(b) Here is the new MST algorithm. The input is some undirected graph G=(V,E) (in adjacency list format) with edge weights {we}.sort the edges according to their weights for each edge , in decreasing order of we:
if e is part of a cycle of G:
G = G - e (that is, remove e from G )
return G , Prove that this algorithm is correct.
(c) On each iteration, the algorithm must check whether there is a cycle containing a specific edge . Give a linear-time algorithm for this task, and justify its correctness.
(d) What is the overall time taken by this algorithm, in terms of ? Explain your answer.
Show that for any integer n that is a power of 2 , there is an instance of the set cover problem (Section 5.4) with the following properties:
Thus the approximation ratio we derived in the chapter is tight.
A binary counter of unspecified length supports two operations: increment (which increases its value by one) and reset (which sets its value back to zero). Show that, starting from an initially zero counter, any sequence of n increment and reset operations takes time ; that is, the amortized time per operation is O(1) .
What do you think about this solution?
We value your feedback to improve our textbook solutions.