Upload
simon-daniels
View
230
Download
0
Embed Size (px)
Citation preview
Trees and Distance
2.1 Basic properties Acyclic : a graph with no cycle Forest : acyclic graph Tree : connected acyclic graph Leaf : a vertex of degree 1 Spanning subgraph of G : a subgraph with v
ertex set V(G) Spanning tree : a spanning subgraph that is
a tree Star : a tree consisting of one vertex adjace
nt to all the others.
Properties of trees Lemma : every tree with at least two vertices has at
least two leaves. Deleting a leaf from an n-vertex tree produces a tree with n-1 vertices.
Theorem : (A) G is connected and has no cycles(B) G is connected and has n-1 edges(C) G has n-1 edges and no cycles(D) For u,v V(G), G has exactly one u,v-path
Proof theorem A -> B,C : by induction on n. B-> A,C : delete edges from cycles of G one b
y one…. C -> A,B : let G has k components. e(Gi) = n(G
i)-1 . e(G)=i[n(Gi)-1]=n-k…. A->D : if some pair of vertices is connected b
y more than one path, it will form a cycle. D->A : if G has a cycle, then G has more than
one u,v – path .
Properties of trees Corollary : (a) every edge of a tree is a cut edge. (b) adding
one edge to a tree forms exactly one cycle. (c) every connected graph contains a spanning tree.
Proposition : if T,T’ are spanning trees of G and e E(T)-E(T’), then there is an edge e’ E(T’)-E(T) such that T-e+e’ is a spanning tree of G.
Properties of trees Proposition : if T is a tree with k edges and
G is a simple graph with (G)k, then T is a subgraph of G.
Distance in trees and graphs
d(u,v) : is the least length of a u,v-path Diameter : max u,vV(G) d(u,v) Eccentricity of a vertex u, (u) : max u,v
V(G) d(u,v) Radius of G : is min uV(G) (u)
Distance in trees and graphs Theorem : if G is a simple graph, then dia
mG3 -> diamĜ3 Proof : u,v have no common neighbor. x
V(G)-{u,v} has at least one of {u,v} as a nonneighbor. This makes x adjacent in to Ĝat least one of {u,v}. uvE( )….Ĝ
Distance in trees and graphs Center of G : the subgraph induced by the vertic
es of minimum eccentricity. Theorem : the center of a tree is a vertex or an e
dge.
Wiener index
Wiener index of G : D(G) = u,vV(G)dG(u,v) Theorem : among trees with n vertices, the
Wiener index D(T) is minimized by stars and maximized by paths ,both uniquely.
2.2 spanning trees and enumeration
Prüfer code : 12 34
56
7
8
{7}
{7,4}
{7,4,4}
{7,4,4,1}
{7,4,4,1,7}
{7,4,4,1,7,1}
Prüfer code
12 34
56
7
8
{7,4,4,1,7,1}
{4,4,1,7,1}
{4,1,7,1}
{1,7,1}
{7,1}
{1}
enumeration
Corollary : given positive integers d1,…, dn summing to 2n-2, there are exactly (n-2)!/(di-1)! Trees with vertex set [n] such that vertex i has degree di, for each i.
Spanning trees in graphs Proposition : Let (G) denote the number of spanni
ng trees of a graph G. If eE(G) is not a loop, then (G)=(G-e)+(G‧e)
Matrix tree theorem
Decomposition and graceful labelings A graceful labeling of a graph G with m edges is a fu
nction f:V(G)->{0,…,m} such that distinct vertices receive distinct numbers and {|f(u)-f(v)|:uvE(G} ={1,…,m}.
Conjecture : every tree has a graceful labeling. Theorem : if a tree T with m edges has a graceful la
beling, then K2m+1 has a decomposition into 2m+1 copies of T.
caterpillar Caterpillar : a tree in which a single path is
incident to (or contains) every edge.
Theorem : A tree is a caterpillar iff it does not contain the tree Y above.
Y
Branchings and eulerian digraphs Branching(out-tree) : an orientation of a tree havin
g a root of indegree 0 and all other vertices of indegree 1.
Theorem : directed matrix tree theorem : the number of spanning out-trees of G rooted at vi is the value of each cofactor in the ith row of Q- (Q- =D--A’).
0 0 0
Q- = -1 1 0
-1 -1 2
0 0 0
A’ = 1 0 0
1 1 0
0 0 0
D- = 0 1 0
0 0 2
Eulerian circuit in directed graph Lemma : in a strong digraph, every vertex is the roo
t of an out-tree. Eulerian circuit in directed graph algorithm :
2.3 Optimization and Trees
Theorem : in a Eulerian digraph with di=d+(vi)=d-(vi) the number of Eulerian circuits is ci(di-1)!, where c counts the in-trees to or out-trees from any vertex.
Weighted graph : a graph with numerical labels on the edges
Minimum spanning tree
Kruskal’s Algorithm :
1 8
7
11
10
12
5 3
6
9
2 4
Shortest paths Distance d(u,z) in a weighted graph is the minimu
m sum of the weights on the edges in a u,z-path. Dijkstra’s algorithm :
1 4
3
4
5
e
6
5 d
2
u
a
cb
1
3
5
6
8{u,a}
a
b
c
d
e
s
1
3
1
3
5
6
1
3
5
6
1
3
5
6
8{u,a,b,c,d}
{u,a,b}
{u,a,b,c}
{u,a,b,c,d,e}
Chinese Postman Problem
BFS algorithm Chinese Postman Problem
1
1
1 1
1
1
2
2
2
2
3
3 3
3
4
4 4
4
7
7
Trees in computer science
Binary tree : a rooted tree where each vertex has at most two children.
K-ary tree allows each vertex up to k children.
Prefix-code Huffman’s algorithm