# HW 7

## 1 Theory

1. 5.20 (from text)
2. Consider an undirected graph G = (V,E) with n = |V| and m = |E|. The degree of a vertex is the number of edges incident on that vertex. Let di be the degree of vertex vi, Show that
SUM[1..n]( di ) = 2m
3. In a directed graph, we can talk about in-degree and out-degree, the number of edges, respectively, arriving and leaving a given vertex. Show that the sum of the in-degrees of a graph is equal to the sum of the out-degrees.
4. 6.1 (from text).

## 2 Implementation

1. (Makefile target: prob1) Implement a disjoint set system using a tree representation (use references, or a parent array). In particular, you should implement an Initialize() function that creates n one-element sets given an array of n things, as well as the functions Find() and Merge(). Implement the better version of disjoint sets (where smaller sets parent to larger sets and finds implement path compression).

You are to provide the file set.py. The program to run is provided, test-set.py.