Professional Documents
Culture Documents
Graph Theory
Graph Theory
Graph Theory
Trees
An acyclic graph (also known as a forest) is a graph with no cycles. A tree is a connected
acyclic graph. Thus each component of a forest is tree, and any tree is a connected forest.
Generally speaking, algorithms associated with trees can be divided into three types.
For example,
www.personal.kent.edu/~rmuhamma/GraphTheory/MyGraphTheory/trees.htm 1/12
2/21/14 Graph Theory
Spanning Trees
Let G be a connected graph. A spanning tree in G is a subgraph of G that includes all the
vertices of G and is also a tree. The edges of the trees are called branches.
www.personal.kent.edu/~rmuhamma/GraphTheory/MyGraphTheory/trees.htm 2/12
2/21/14 Graph Theory
Cutting-down Method
Start choosing any cycle in G.
Remove one of cycle's edges.
Repeat this procedure until there are no cycle left.
www.personal.kent.edu/~rmuhamma/GraphTheory/MyGraphTheory/trees.htm 3/12
2/21/14 Graph Theory
1. We remove the edge ac which destroy the cycle adca in the above graph and
we get
2. We remove the edge cb, which destroy the cycle adcba in the above graph and
we get
3. We remove the edge ec, which destroy the cycle decd in the above graph and
thus obtained the following spanning tree.
www.personal.kent.edu/~rmuhamma/GraphTheory/MyGraphTheory/trees.htm 4/12
2/21/14 Graph Theory
Building-up Method
Select edges of G one at a time. in such a way that no cycles are created.
Repeat this procedure until all vertices are included.
www.personal.kent.edu/~rmuhamma/GraphTheory/MyGraphTheory/trees.htm 5/12
2/21/14 Graph Theory
4. Finally, we choose the edge cb and thus obtain the following spanning tree.
Proof Let G be a connected graph. Delete edges from G that are not bridges until we get
a connected subgraph H in which each edge is a bridge. Then H is a spanning tree. On the
other hand, if there is a spanning tree in G, there is a path between any pair of vertices in G;
thus G is connected.
There are two straight forward ways to compute centers and bicenters.
www.personal.kent.edu/~rmuhamma/GraphTheory/MyGraphTheory/trees.htm 6/12
2/21/14 Graph Theory
Algorithm1
Remove all the vertices of degree1,
together with their incident edges.
Repeat the process until we obtain either
a single vertex (the center) or two
vertices joined by an edge (the bicenter).
A tree with a center is called a central tree, and a tree with a bicenter is called a bicentral tree.
Note that every tree is either central or bicentral, but not both.
www.personal.kent.edu/~rmuhamma/GraphTheory/MyGraphTheory/trees.htm 7/12
2/21/14 Graph Theory
Algorithm 2
For each vertex v of the degree 2 or more, count the number of vertices in each of the
subtrees emanating from v, and let nv be the maximum of these numbers. If the tree has n
vertices it can be shown that either there is just one vertex v for which nv ≤ 1/2(n-1) (the
centroid or centroid tree) or there are two adjacent vertices v and w for which nv = nw = 1/2n
(the bicentroid or bicentroid tree). It is easy to see that every tree is either centroidal or
bicentroidal, but not both.
Note that we can think of the centroid or bicentroid as the 'center of gravity' of the tree.
www.personal.kent.edu/~rmuhamma/GraphTheory/MyGraphTheory/trees.htm 8/12
2/21/14 Graph Theory
Tree Searching
There are two well-known search methods. They are brown as depth-first search( DFS) and
breadth-first search (BFS). Each of these methods lists the vertices as they are encountered,
and indicates the direction in which each edge is first traversed. The methods differ only in
the way in which the vertex-lists are constructed.
a -> b --> d --> i -> j -> k -> e -> c -> f -> i -> g -> h.
www.personal.kent.edu/~rmuhamma/GraphTheory/MyGraphTheory/trees.htm 10/12
2/21/14 Graph Theory
Note that we have marked those edges we used when going to new vertex. These edges form
a spanning tree, called a DFS spanning tree.
a --> b --> c --> d --> e --> f --> g --> h --> i --> j --> k --> e
above example clearly shows that breadth-first search must complete each level before
proceeding to the next one.
www.personal.kent.edu/~rmuhamma/GraphTheory/MyGraphTheory/trees.htm 11/12
2/21/14 Graph Theory
Note that we have marked those edges we used when going to new vertex. These edges form
a spanning tree, called a BFS spanning tree.
www.personal.kent.edu/~rmuhamma/GraphTheory/MyGraphTheory/trees.htm 12/12