Sequence Local Alignment using Directed Acyclic Word Graph Do Huy Hoang.
Trees and Distance. 2.1 Basic properties Acyclic : a graph with no cycle Forest : acyclic graph Tree...
-
Upload
simon-daniels -
Category
Documents
-
view
230 -
download
0
Transcript of Trees and Distance. 2.1 Basic properties Acyclic : a graph with no cycle Forest : acyclic graph Tree...
![Page 1: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/1.jpg)
Trees and Distance
![Page 2: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/2.jpg)
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.
![Page 3: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/3.jpg)
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
![Page 4: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/4.jpg)
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 .
![Page 5: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/5.jpg)
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.
![Page 6: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/6.jpg)
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.
![Page 7: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/7.jpg)
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)
![Page 8: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/8.jpg)
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( )….Ĝ
![Page 9: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/9.jpg)
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.
![Page 10: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/10.jpg)
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.
![Page 11: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/11.jpg)
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}
![Page 12: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/12.jpg)
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}
![Page 13: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/13.jpg)
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.
![Page 14: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/14.jpg)
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)
![Page 15: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/15.jpg)
Matrix tree theorem
![Page 16: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/16.jpg)
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.
![Page 17: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/17.jpg)
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
![Page 18: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/18.jpg)
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
![Page 19: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/19.jpg)
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 :
![Page 20: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/20.jpg)
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
![Page 21: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/21.jpg)
Minimum spanning tree
Kruskal’s Algorithm :
1 8
7
11
10
12
5 3
6
9
2 4
![Page 22: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/22.jpg)
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}
![Page 23: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/23.jpg)
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
![Page 24: 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.](https://reader031.fdocuments.us/reader031/viewer/2022031909/56649ec05503460f94bcc52e/html5/thumbnails/24.jpg)
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