Solutions to Homework Four

CSE 101

5.1. The graph has two minimum spanning trees, of cost 19. There are several different orders in which Kruskal might potentially add the edges, for instance: Edge A−E E−F B−F F −G G−H C −G D−G

one side of cut {A} {A, E} {A, E, F } {A, B, E, F } {H} {C} {D}

5.4. Claim: A graph G with k connected components must have at least |V | − k edges. Take any such G = (V, E) and run an iterative trimming procedure on it: “while there is a cycle, remove an edge from the cycle”. The result is a forest of k trees; say they contain n1 , n2 , . . . , nk nodes respectively (where n1 + · · · + nk = |V |). Then they must contain n1 − 1, . . . , nk − 1 edges respectively, for a total of |V | − k. Therefore G must originally have had at least this many edges. 5.6. Claim: If all edges in an undirected graph have different weights, then the MST is unique. Suppose this isn’t the case – suppose there are two distinct MSTs T and T ′ . We’ll find a contradiction. Let e be the lightest edge which is present in one of the MSTs but not the other. Say it’s in T but not T ′ (it doesn’t make a difference either way). Then T ′ ∪ {e} contains a cycle C. There must be some edge e′ of this cycle which is not in T (T can’t contain all of C because it is a tree). Then T ′′ = T ′ ∪ {e} − {e′ } is once again a tree. However, notice that e′ is part of T ′ but not T . Since e was the lightest edge of this type (ie. in one tree but not the other), and since edge weights are distinct, w(e) < w(e′ ). But then T ′′ has weight weight(T ′′ ) = weight(T ′ ) + w(e) − w(e′ ) < weight(T ′ ), a contradiction since T ′ is an MST. 5.11. Path compression example.

8

1

2

4

5

6

7

3 5.22. (a) Claim: Pick any cycle in a graph, and let e be the heaviest edge in that cycle. Then there is a minimum spanning tree that does not contain e. Call the cycle C. We’ll show that for any spanning tree T that contains e, there is another spanning tree T ′ which doesn’t contain e and whose weight is at most that of T . Remove e from T ; this splits T into two subtrees, T1 and T2 . Since e crosses the cut (T1 , T2 ), the cycle C must contain at least one other edge e′ across this cut. Let T ′ = T − e + e′ . T ′ is connected and has |V | − 1 edges; therefore it is a spanning tree. And since w(e) ≥ w(e′ ), the weight of T ′ is at most that of T . 1

(b) Prove that the new MST algorithm is correct. Let Gt be what remains of the graph after t iterations of the loop. Part (a) tells us that for any t, we have MST(Gt+1 ) = MST(Gt ); by induction, we therefore have MST(GT ) = MST(G), where GT is the final graph. This GT has no remaining cycles and is therefore a spanning tree, whereby it must be a minimum spanning tree of G. (c) Give a linear-time algorithm to check if G has a cycle containing a specific edge e. Algorithm: If e = {u, v}, run explore(G − e, u). If v is visited return yes else return no. Justification: G has a cycle containing e if and only if there is a path from u to v in G − e. (d) What is the overall time taken by this algorithm? Sorting takes O(|E| log |E|) and there are |E| iterations of the loop, each of which takes time O(|E|). The total is therefore O(|E|2 ). 5.26. Here’s a problem that occurs in automatic program analysis. For a set of variables x1 , . . . , xn , you are given some equality constraints, of the form “xi = xj ” and some disequality constraints, of the form “xi 6= xj .” Is it possible to satisfy all of them? Give an efficient algorithm that takes as input m constraints over n variables and decides whether the constraints can be satisfied. Denote the set of variables by V . Let E be the equality constraints and D the disequality constraints. for all u ∈ V : makeset(u) for all (u, v) ∈ E: union(u, v) for all (u, v) ∈ D: if find(u) = find(v): halt and output ‘‘not satisfiable’’ output ‘‘satisfiable’’ Justification: Consider an undirected graph with nodes V and edges E. The connected components of this graph are precisely the sets of variables which must have the same value. The problem is not satisfiable if and only if there is a disequality constraint between two of these connected components. Running time: Since union and find operations take time O(log n), the overall running time is O(n + (|D| + |E|) log n) = O(n + m log n).

2

Solutions to Homework Four -

The graph has two minimum spanning trees, of cost 19. There are several different orders in which. Kruskal might potentially add the edges, for instance: Edge.

51KB Sizes 98 Downloads 190 Views

Recommend Documents

12_09 Homework Solutions
r F. F. F.. AA 15-18 Use a table of values to estimate the limit. Then use a 17. lim 8x-s/e-cx graphing device to confirm your result graphically, i. e." S-. Wr + 41. 's.

Homework 12 Solutions Problem 1
(where these operators are the ordinary Killing vectors, denoted by fµ = ϵM fM. µ in class.) Comment 1: The deeper reason for this minus sign follows from the ...

CSC 124: Solutions to homework problems
Feb 12, 2009 - Solution. In one of the lectures, we worked out an example similar to this ˛rst homework problem. In that example, our goal was to map two ...

7.2 Homework Solutions 2017.pdf
There was a problem previewing this document. Retrying... Download. Connect more ... 7.2 Homework Solutions 2017.pdf. 7.2 Homework Solutions 2017.pdf.

HOMEWORK
Homework​​is one​​of​​the​​options​​parents/legal​​guardians​​have​​to​​support​​their​​child's learning.

Homework 1
Question 3. As you have learnt, a number of hosts using Ethernet, share a single channel and each collision decreases throughput. If hosts on a 6-host 10Mbps 80m Ethernet LAN send frames 64byte long, a. what is the scenario that maximizes throughput

Homework 3
Lecture 6: Programming in R. 1) Load the warpbreaks data set and attach it.* This data set gives the number of warp breaks per loom, where a loom corresponds ...

Homework #1 - GitHub
Please select either bus 2 or 3 as reference bus, calculate the line flows, and check if the results are the same. 2. Come up with a case study of LP, and solve it in ...

Homework Hotline.pdf
Whoops! There was a problem loading more pages. Whoops! There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. Homework Hotline.pdf. Homework Hotline.pdf. Open. Ex

Homework 12 - Magnetism - GitHub
region containing a constant magnetic field B = 2.6T aligned with the positive ... With what speed v did the particle enter the region containing the magnetic field?

Homework Practice - WinningWithLinningMath
of the girls have blue eyes, what fraction of the girls in class have neither blue or brown eyes? 16. PIE Ubi made a banana cream pie. His brother ate. 1. −. 3.

homework
ventus and I was in San Siro Stadium when Inter won the. 'scudetto' with a 5-0 win. 2003 was the first year Valletta qualified for the UEFA. Champions League and the fist game was Valletta versus AC. Milan. Ta' Qali was in a craze when Massimo scored

solutions to concepts - PlusTwoPhysics
May 18, 1992 - When the monkey descends through a distance 'L' .... So net external force during this process is 0. So the centre mass will not change.

Homework #4
Returned: Friday, March 25, 2016. 1. Growth of structure with neutrinos. [30 points; 5 points each]. In most of our studies of the matter-dominated era in class, we ...

solutions to concepts - PlusTwoPhysics
May 18, 1992 - Given momentum of electron = 1.4 × 10–26kg m/sec .... (V′ is the change is velocity of the platform when platform itself is taken as reference ...

homework-help.pdf
Page 1 of 22. Alternative Homework Ideas. We compiled this list from ideas collected from the Love and Logic Insider Club. members. Thank you to everyone ...

Homework 2
Recall the unitary group U1 = {z ∈ C | |z| = 1}. Find all the one dimensional continuous complex representations of U1. 5. Let G be a finite group. Let ρ : G −→ GLn(R) be an n-dimensional real representation. Prove that there exists a matrix Ï

Homework 3.pdf
Page 1 of 3. Homework 3 參考解答. 1. First, let's clarify what the function max (݂(݊), ݃(݊)) is. Let's define the. function h(݊) = max (݂(݊), ݃(݊)). Then. h(݊) = ൜݂(݊) if ݂(݊) ≥ ݃(݊),. ݃(݊) if ݃(݊) < ݂(݊). Since ݂(݊) a