Suppose that the vertices of a graph represent towns and the edges of the graph are roads between these towns. Label each edge with the distance between the towns. If it is desired to run optical cable along the roads so that all the towns are connected, where should the cable be put to minimize the amount of cable used? To answer this type of question we need to be able to find a spanning tree in the graph so that the sum of the numbers on the edges is as small as possible (amongst all spanning trees).
Prop 3.1.6: Every tree on n vertices contains exactly n-1 edges.
Notation: The number of components of a graph G is denoted by c(G).
½(n-k)(n-k+1).Cor 3.1.10: A simple n-vertex graph with more than ½(n-1)(n-2) edges must be connected.
Theorem 3.1.11: Let T be a graph with n vertices. Then the following statements are equivalent.
Def: rooted tree.
Theorem 3.2.1: A directed tree is representable as a rooted tree if and only if one vertex has indegree 0 and all other vertices have indegree 1.
Def: level (or depth) of a vertex, height of a tree, parent, child, sibling , descendant, ancestor, leaf, internal vertex.
Def: m-ary tree, complete m-ary tree.
Prop 3.2.2: An m-ary tree has at most mk vertices at level k.
Theorem 3.2.3: Let T be an n-vertex m-ary tree of height h. Then h+1
n
(mh+1 - 1)/(m-1).
Def: ordered tree
Theorem 3.3.1: The complete binary tree of height h has 2h+1 - 1 vertices.
Def: binary code, prefix code
Let T be a binary tree with leaves s1, s2, ... sm such that each leaf si is assigned a weight wi. The average weighted depth of the binary tree T, denoted wt(T) is given by

Huffman Algorithm
Input: A set of symbols S = {s1,s2,...sm} and a set of corresponding weights wi, where wi is the weight associated to the symbol si.
Output: A binary tree representing a prefix code for the set of symbols S whose codewords have minimum average weighted length.
Initialize F to be a forest of isolated vertices, labeled s1,...sm with respective weights w1,..., wm.
For i = 1 to m-1 do
The binary tree produced by this algorithm is called a Huffman tree,and the corresponding prefix code is called a Huffman code.
Lemma 3.3.3: If the leaves of a binary tree are assigned weights, and if each internal vertex is assigned a weight equal to the sum of its children's weights, then the tree's average weighted depth equals the sum of the weights of its internal vertices.
Theorem 3.3.4: For a given list of weights w1,w2,...,wl, a Huffman tree has the smallest possible average weighted depth among all binary trees whose leaves are assigned those weights.