You are on page 1of 9

Elements of Graph Theory

In this section we present the basic concepts related to graphs and trees such as the degree of a vertex,
connectedness, Euler and Hamiltonian circuits, isomorphisms of graphs, rooted and spanning trees.
Graphs, Paths, and Circuits
- An undirected graph consists of a set of vertices and a set of edges such that each edge is
associated with an unordered pair of vertices, called its endpoints.
- A directed graph or digraph G consists of a set of vertices and a set of edges such that each edge
is associated with an ordered pair of vertices.
- We denote a graph by ).
- Two vertices are said to be adjacent if there is an edge connecting the two vertices. Two edges associated
to the same vertices are called parallel.
- An edge incident to a single vertex is called a loop. A vertex that is not incident on any edge is called an
isolated vertex.
- A graph with neither loops nor parallel edges is called a simple graph.
Example: Consider the following graph
a. Find and .
b. List the isolated vertices.
c. List the loops.
d. List the parallel edges.
e. List the vertices adjacent to .
f. Find all edges incident on .
Solution:
a. { } and { }.
b. There is only one isolated vertex, .
c. There is only one loop, .
d. { }. e. { }. f. { }
Example: Which one of the following graphs is simple.

Solution:
a. is not simple since it has a loop and parallel edges. b. is simple.
- A complete graph on vertices, denoted by , is the simple graph that contains exactly one edge between
each pair of distinct vertices.
Example: Draw and .
Solution:

Dr. Nader William Amin Page 1


- A graph in which the vertices can be partitioned into two disjoint sets and with every edge incident on
one vertex in and one vertex of is called bipartite graph.
Example:
a. Show that the graph is bipartite.

b. Show that is not bipartite.


Solution:
a. From graph , we notice that { } and { } .
Thus, according to the definition of bipartite graph, the graph is bipartite
b.

From graph , we notice that { } , { } and { } ,


{ }, { } and { }. Any two sets of vertices of will have one set
with at least two vertices. Thus, according to the definition of bipartite graph, is not bipartite.
- A complete bipartite graph is the graph that has its vertex set partitioned into two disjoint subsets of
and vertices, respectively. Moreover, there is an edge between two vertices if and only if one vertex is
in the first set and the other vertex is in the second set.
Example: Draw and
Solution:

{ }, { } { }, { }

{ } { }
{ } { }
{ }
- The degree of a vertex in an undirected graph, in symbol ; is the number of edges incident on it.
By definition, a loop at a vertex contributes twice to the degree of that vertex.
- The total degree of is the sum of the degrees of all the vertices of .

Dr. Nader William Amin Page 2


Example: What are the degrees of the vertices in the following graph and the total degree of the graph?
Solution:

The total degree of the graph= 6

Theorem:
For any graph , we have
| | ∑

Proof:
Suppose that { } and | | . Let . If is a loop then it contributes 2 to the total
degree of . If is not a loop then let and denote the endpoints of . Then e contributes 1 to and
contributes 1 to the . Therefore, contributes 2 to the total degree of G. Since was chosen arbitrarily,
this shows that each edge of G contributes 2 to the total degree of G. Thus,
| | ∑

The following is easily deduced from the previous theorem.


Theorem:
In any graph there is an even number of vertices of odd degree.
Proof:
Let be a graph. By the previous theorem, the sum of all the degrees of the vertices is | | , an
even number. Let be the sum of the numbers , each which is even and the sum of numbers
each which is odd. Then . That is, . Since both and are even, is also even. This
implies that there must be an even number of the odd degrees. Hence, there must be an even number of vertices
with odd degree.
Example: Find a formula for the number of edges in .
Solution:
Since is complete, each vertex is adjacent to the remaining vertices. Thus, the degree of each of the vertices
is , and we have the sum of the degrees of all of the vertices being
By Theorem , | | . This completes a proof of the theorem

- In an undirected graph a sequence of the form with no edge repeated is


called a path of length or a path connecting to .
- If is a path such that then it is called a circuit or a cycle.
- A path or circuit is simple if it does not contain the same vertex more than once. A graph that does not
contain any circuit is called a cyclic.

Dr. Nader William Amin Page 3


Example: In the graph below, determine whether the following sequences are paths, simple paths, circuits, or
simple circuits.
a. .
b. .
c.
d. .
Solution:
a. a path (no repeated edge), not a simple path (repeated vertex ),
not a circuit
b. a simple path
c. a simple circuit
d. a circuit, not a simple circuit (vertex v4 is repeated)
- An undirected graph is called connected if there is a path between every pair of distinct vertices of the
graph. A graph that is not connected is said to be disconnected.
Example: Determine which graph is connected and which one is disconnected.

(a) (b)
Solution:
a. Connected.
b. Disconnected since there is no path connecting the vertices and .
- A simple path that contains all edges of a graph is called an Euler path. If this path is also a circuit, it is
called an Euler circuit.
Theorem:
If a graph has an Euler circuit then every vertex of the graph has even degree.
Proof:
Let be a graph with an Euler circuit. Start at some vertex on the circuit and follow the circuit from vertex to
vertex, erasing each edge as you go along it. When you go through a vertex you erase one edge going in and one
edge going out, or else you erase a loop. Either way, the erasure reduces the degree of the vertex by 2.
Eventually every edge gets erased and all the vertices have degree 0. So all vertices must have had even degree
to begin with.
It follows from the above theorem that if a graph has a vertex with odd degree then the graph can not have an
Euler circuit.
The following provides a converse to the above theorem.

Dr. Nader William Amin Page 4


Theorem (Euler Theorem):
If all the vertices of a connected graph have even degree, then the graph has an Euler circuit.
Example: Show that the following graph has no Euler circuit.
Solution:
Vertices and both have degree 3, which is odd. Hence,
by the remark following the previous theorem,
this graph does not have an Euler circuit.

- A path is called a Hamiltonian path if it visits every vertex of the graph exactly once. A circuit that visits
every vertex exactly once except for the last vertex which duplicates the first one is called a Hamiltonian
circuit.
Example: Find a Hamiltonian circuit in the graph
Solution:
vwxyzv

Example:
Show that the following graph has a Hamiltonian path but no Hamiltonian circuit.

Solution: vwxyz is a Hamiltonian path. There is no Hamiltonian circuit since no cycle goes through v.

Dr. Nader William Amin Page 5


Trees
An undirected graph is called a tree if each pair of distinct vertices has exactly one path between them.
Thus, a tree has no parallel edges and no loops.
We next show a result that is needed for the proof of our first main theorem of trees.
Theorem 1 :
Any tree with more than one vertex has one vertex of degree 1.
Proof:
Let T be a tree with a number of vertices . Pick a vertex at random and search outward from on a path
along edges from one vertex to another looking for a vertex of degree one. As each new vertex is reached, check
whether it has degree 1. If so, a vertex of degree 1 has been found. If not, it is possible to exit from the new
vertex along a different edge from that used to reach the vertex. Because T is a tree, it is circuit-free, and so the
path never returns to a previously used vertex. Since the number of vertices of T is finite, the process of
building a path must eventually terminate. When that happens, the final vertex of the path must have degree 1.
The following is the first of the two main theorems about trees:
Theorem 2:
A tree with n vertices has exactly edges.
Proof:
The proof is by induction on : Let be the property: Any tree with n vertices has edges.
Basis of induction: is valid since a tree with one vertex has zero edges.
Induction hypothesis: Suppose that holds up to .
Induction Step: We must show that any tree with vertices has edges.
Indeed, let T be any tree with vertices. Since ; by the previous theorem, T has a vertex of
degree 1. Let be the graph obtained by removing and the edge attached to : Then is a tree with
vertices. By the induction hypothesis, has edges and so has edges.
Example: Which of the following graphs are trees?

Solution:
The first graph satisfies the definition of a tree. The second and third graphs do not satisfy the conclusion of
Theorem2 and therefore they are not trees.
The second major theorem about trees is the following theorem whose proof is omitted.
Theorem3:
Any connected graph with vertices and edges is a tree.

Dr. Nader William Amin Page 6


- A rooted tree is a tree in which a particular vertex is designated as the root. The level of a vertex is the
length of the simple path from the root to .The height of a rooted tree is the maximum level number that
occurs.
Example: Find the level of each vertex and the height of the following rooted tree.
Solution:
is the root of the given tree.
vertex level
1
1
2
2
2
2
The height of the tree is 2.
- Let T be a rooted tree with root : Suppose is a simple path in T and are
three vertices. Then
(a) is the parent of .
(b) are the ancestors of .
(c) is the child of .
(d) If is an ancestor of then is a descendant of .
(e) If and are children of then and are siblings.
(f) If has no children, then is a leaf.
(g) The subtree of T rooted at is the graph with vertex set V and edge set E, where V is together with the
descendants of and { }.
Example: Consider the rooted tree
a. Find the parent of . b. Find the ancestors of .
c. Find the children of . d. Find the descendants of .
e. Find an example of a siblings. f. Find the leaves.
g. Construct the subtree rooted at .
Solution:
a. . b. .
c. . d. None.
e. { }. f. { }.
g.

Dr. Nader William Amin Page 7


- A binary tree is a rooted tree such that each vertex has at most two children. Moreover, each child is
designated as either a left child or a right child.
Example:
a. Show that the following tree is a binary tree.
b. Find the left child and the right child of vertex .
c. A full binary tree is a binary tree in which each vertex has either two
children or zero children. Construct an example of a full binary tree.
Solution:
a. Follows from the definition of a binary tree.
b. The left child is and the right child is
c.

Example: A forest is a simple graph with no circuits. Which of the following graphs is a forest?

Solution:The first graph is a forest whereas the second is not.


Example:
a. Let T be a subgraph of a graph G such that T is a tree containing all of the vertices of G. Such a tree is called
a spanning tree. Find a spanning tree of the following graph.
b. The following algorithm finds a spanning tree. In this algorithm S denotes
a sequence. Let G be a connected graph with vertices ordered

1. Let T be the tree with root and no edges.


2. Add to T all edges and vertices on which they are incident, provided
that does not produce a circuit. If no edges can be added, stop (T is
a spanning tree)
3. Replace S by the children in T of S ordered consistently with the original ordering. Go to step 2.
Use the above algorithm to find the spanning tree of part a.
Solution:

Dr. Nader William Amin Page 8


Exercise:
1) Find the in-degree and out-degree of each of the vertices in the graph G with directed edges.

2) Show that the following graphs are not isomorphic.

3) Find the level of each vertex and the height of the following rooted tree.

4) Consider the rooted tree


a. Find the parent of v6.
b. Find the ancestors of v10.
c. Find the children of v4.
d. Find the descendants of v1.
e. Find all the siblings.
f. Find the leaves.
g. Construct the subtree rooted at v1.

Dr. Nader William Amin Page 9

You might also like