0% found this document useful (0 votes)
15 views

chapters 3 ,4 ,5

Uploaded by

cherkos welday
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

chapters 3 ,4 ,5

Uploaded by

cherkos welday
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

CHAPTER-3

GRAPH THEORY

INTRODUCTION

There are many concrete, practical problems that can be simplified and solved by looking at them from
a different point of view. The Konigsberg Bridge Problem, which we will soon describe, was a long-
standing problem until it was imaginatively solved in 1736 by the great Swiss mathematician
LUonhard Euler (1707-1783). Beginning his scientific career shortly after the death of Sir Isaac
Newton, Euler spent the last 17 years of his life blind, but still very active. Some of his mathematical
contributions were to the theory of convergent sequences and to the calculus of variations. Much of
what is taught today about quadratic equations, conic sections, and quadrics in Euclidean space is just
as Euler himself laid out. Perhaps less known is that Euler was a superb designer of algorithms; he had
the uncanny ability of making order out of chaos, of seeing simple routes through the most
complicated situations. It is because of his imaginative solution to the Konigsberg Bridge Problem that
Euler is generally considered to be the father of
modern-day graph theory. In the eighteenth century, Kinigsberg was the capital of East Prussia.' The
Pregel River flowed through town and split into two branches around Kneiphof island, which is labeled
A in Fig 9.1. Seven bridges crossed the river, providing links among the four land masses labeled A, B,
C, D in the figure. People wondered if it were possible to start on one of the land masses, walk over
each of the seven bridges exactly once, and return to the starting point (without getting wet).To find an
abstract mathematical model of a concrete problem can be a difficult task requiring both ingenuity and
experience. The primary aim of this chapter is to
provide the reader with some of this experience by presenting several real-world

Fig. The bridges of Konigsberg.

Problems and showing how they can be formulated in mathematical terms. This process of translation
into mathematics forces us to sift through all the details of the problem, deciding which ones are
important and which are extraneous. (Those aspects of a "real" problem which make it interesting are
sometimes quite irrelevant and serve primarily to create confusion!) Because the language of
mathematics is precise and without ambiguity, problems which seem complicated when expressed in
ordinary language often have surprisingly straightforward mathematical translations.

A graphical representation of the


Kdnigsberg Bridge Problem

For the Konigsberg Bridge Problem, Euler's idea was to realize that the physical layout of land, water,
and bridges could be modeled by the graph shown in the above figure. The land masses are represented
by small circles (or vertices) and the bridges by lines (or edges) which can be straight or curved. By
means of this graph, the physical problem is transformed into this mathematical one: Given the graph
in is it possible to choose a vertex, then to proceed along the edges one after the other and return to the
chosen vertex covering every edge exactly once? Euler was able to show that this was not possible.
Can you? The Three Houses-Three Utilities Problem is another physical situation which can be
modeled by means of a graph. There are three houses, each of which is to be connected to each of three
utilities-water, electricity, and telephone by means of underground pipes. Is it possible to make these
connections without any
Crossovers? Figure below shows how to describe this problem with a graph. The houses and the
utilities are represented by vertices and the pipes are the lines drawn between the vertices.

The Three Houses-


Three Utilities
Problem.

Terminology of Graph

Graphs
A graph G is a discrete structure consisting of nodes (called vertices) and lines joining the nodes
(called edges). Two vertices are adjacent to each other if they are joint by an edge. The edge joining
the two vertices is said to be an edge incident with them. We use V (G)and E(G) to
denote the set of vertices and edges of G respectively.

For any graph the vertex set V is always non-empty but the edge set E(G) can be empty { if 𝐸(𝐺) =
∅ then the graph G is called a null graph} and a vertex is isolated (An isolated vertex is a vertex whose
degree is 0) if it has no edges incident to it.

Example:

u and v are adjacent vertices; e is an edge incident with u and v. e can also be denoted by uv or vu.

Loops and Multiple Edges:


An edges that joins vertex to itself is called a loop. If there are more than one edge joining u and v of
G,then all edges joining u and v form a multiple edge of G.

Simple Graph:
A simple graph is a graph containing no loops and multiple edges.

Degrees of Vertices:
The degree of a vertex is the number of edges incident with it, except that a loop at a vertex
contributes twice to the degree of that vertex. The degree of the vertex v is denoted by deg(v) or d(v).
Example: find the degree of each of the ff graphs

d(u) = 5 , d(v) = 3
and d(w) = 2

Exercise:
Find the degree of every vertex of the following graph. When two lines cross, but there isn’t a dot, that
does not count as a vertex, so this graph has only 6 vertices.

Theorem: [The handshaking theorem] Let G be a graph with e edges. Then

Note: The number of vertices of odd degree in a graph G is even.

Complete Graphs:
The complete graph on n vertices, denoted by 𝐾𝑛 is the simple graph in which any pair of vertices are
adjacent.

Example:

Subgraphs:
A sub-graph of a graph G is a graph H where V (H)⊆V (G) and E(H)⊆ E(G).
Example:

Complete graph: is simple graph in which every pair of its distinct vertices are adjacent. A complete
graph with n vertices is denoted as 𝐾𝑛 . The first four complete graphs are
given as examples:

Matrix representation of graphs

(Please read how to add and multiply matrices first)

Adjacency Matrices:
Definition: Given a graph G with vertex set 𝑉 = {𝑣1 , 𝑣2 , … 𝑣𝑛 } and edge set E, we define the
adjacency matrix of G as follows: Let G be an graph. Suppose 𝑣1 , 𝑣2 , … 𝑣𝑛 are the vertices of G. Then
the adjacent matrix with respect to this ordering of V (G) is the n× n matrix = [𝑚𝑖𝑗 ] , where
1 , when vi and v j are adjacent
mij  
0 , otherwise

Example:

𝑀𝑖𝑗 = the number of edges connecting 𝑣𝑖 and 𝑣𝑗 in G

Note that an adjacency matrix of a graph is based on the ordering chosen for the vertices. Hence, there
are as many as n! different adjacency matrices for a graph with n vertices, because there are n!
different orderings of n vertices. The adjacency matrices of a simple graph is symmetric
because if vi is adjacent to vj , then vj is adjacent to vi and if vi is not adjacent to vj , then vj is not
adjacent to vi . Since a simple graph can not have a loop. For the following graph its adjacency matrix
given below.

Note: arrow with all zeros represents an isolated vertex


ChAPTER-4

CIRCUIT AND PATH COLORING

Paths: (way of getting from one vertex to another via edges)


- sequence of vertices in which successive vertices are
joined by an edge that is, A path in a graph is a sequence
of edges that links together two vertices
 Ex. Path from vertex A to vertex C (e2,e5 or e2, e7, e6) Etc.
 A path may have repeated edges (e2,e3,e1,e2,e5).
 The length of a path is determined by the number of edges in that path
 The degree of a vertex is the number of edges touching the vertex.
(loops count twice)

A simple path: is a path in which no vertex is repeated (e2, e7, e6, e4)

A closed path: is a path in which the first and last vertices are the same (e2, e7, e6, e4, e1)
A graph is connected if every pair of vertices is joined by a path.

A circuit is a closed path in which no edges are repeated (e2, e7, e6, e4, e1).
A simple circuit is a circuit with no repeated vertices except for the first and the last (e2, e7, e6, e4,
e1).

Any path that traces the graph by going across each edge exactly once but each vertex atleast once and
starts and ends at the same vertex is called an Euler circuit.
Euler’s Theorem: A graph contains a Euler Circuit if:
1. Graph is Connected
2. Every vertex is of even degree

If a graph has a vertex with odd degree

Then the graph can not have an Euler


circuit. For example this graph has no Euler
circuit
Exercise: Explain why find an answer to the Bridges of Koenigsburg problem is the same as finding
an Euler circuit on the graph shown. (The vertices are like the land masses, and the bridges are
represented by the edges. So finding a solution to the problem is like crossing every edge once, which
is the same as an Euler circuit)

Euler showed that if there is any vertex of the graph that has odd degree, then the graph does not have
an Euler circuit. He also showed that if all of the vertices of the edges have an even degree, then the
graph does have an Euler circuit.

This graph has an Euler circuit, because all of


the vertices have even degree. You can find
the circuit by traveling
along the graph in this order:
A → B →D →C →B →A.
(Notice that vertex B is used twice. This is fine in an Euler circuit.)

Does the graph showing the Koenigsburg bridges have an Euler circuit? Why or why not?
(ANS: It does NOT because it has vertices with odd degree.)
For each of the graphs shown below, decide if they have an Euler circuit. If they do, find an Euler
circuit. If it doesn’t have an Euler circuit, explain why not

Another problem that can be studied through graph theory is what is called the “traveling salesman
problem.” One example from that problem is shown below. It shows 4 cities that a sales representative
would visit, and the distances (in miles) between the cities. The problem is to find the best order for the
sales representative to visit the cities, and return to the starting point, so that the shortest distance
possible is travelled.

Write down some possibilities for paths the sales representative could take, starting in Denver. Which
one is the shortest? Write all of the possibilities that you tested in your math journal. Shortest is 444
miles, and the route is Denver→Limon→Lamar→Pueblo→Denver. (The reverse route is also
correct.)
Hamilton circuit

Definition : A Hamilton path in a graph is a path that visits each vertex exactly once. If such a path
is also a circuit, it is called a Hamilton circuit

Travelling Salesman: is an example of Hamiltonian circuit

 We know finding a Hamiltonian circuit is hard..


 The problem here: if we have a weighted graph, and want to find the circuit with the lowest weight.
o The usual explanation: a salesman has to visit all of his clients and wants to make the journey
with the least time/distance/fuel.
o We use the value we're trying to minimize as the edge weight.
 In this case, the graph is probably complete (or nearly complete).
o You can probably drive between any two cities somehow.
o So there will probably be a Hamiltonian circuit.
o The question here is more about finding the best route.

Graph Coloring

Definition:

A coloring of a simple graph is the assignment of a color to each vertex so that no two adjacent
vertices have the same color.

A graph is K-colorable if each vertex can be assigned one of the K-colors so that adjacent vertices get
different colors.

The chromatic number of the graph G the list number of colors needed to color a graph.

Example: here are some graphs and the corresponding chromatic numbers

Some applications of graph coloring

 Transmitters and channel assignment


 Fast register assignment
 Final exam scheduling i.e vertices = classroom sections (over all courses) two sections are
adjacent if there exists student in both
 In Cartography:

The Four Color Theorem

The original problem was stated to be:“the greatest number of colors to be used in coloring a map so
as to avoid identity of color in lineally contiguous districts is four.”

A scheduling problem:
Suppose you're organizing a mathematics conference. You have several people that are setting up
special sessions in their area of expertise. You're trying to find a way to schedule the sessions so that if
there are overlapping interests, you can make sure the sessions happen at di_erent times. To that end,
you've asked each session organizer to tell you what broad fields of mathematics their subject
concerns. You have the following list:
 Probabilistic Combinatorics: of interest to Analysts, Combinatorialists, and Probabilists.
 Algebraic Combinatorics: of interest to Algebraists and Combinatorialists
 Enumerative Combinatorics: of interest to Combinatorialists and Representation Theorists
 Ramsey Theory: of interest to Combinatorialists and Probabilists
 Markov Chains: of interest to Probabilists
 Brownian Motion: of interest to Probabilists and Analysts
 Operator Theory: of interest to Analysts
You'd like to schedule the shortest conference possible, so that you don't have to pay for the rooms for
too long. What is the fewest number of sessions you could run to accommodate every session, where
no two topics run at the same time if they have overlapping interests?

Graph coloring, and a solution to the scheduling problem:


This is really a question about graph theory. We can represent the conflicts above using a graph. We let
the vertex set be the seven subjects, and draw an edge between two subjects if they have a conflicting
area of interest, as shown in the graph below.
Our scheduling problem can now be phrased as follows: divide the vertices of the graph into sets so
that no vertices with an edge between them belong to the same set. This can be seen through the lens of
graph coloring.
A coloring of a graph G is an assignment of colors to the vertices of G so that if vertex u is adjacent
to vertex v, then the colors assigned to u and v are different. If we can color our conflict graph with the
fewest number of colors possible, we can schedule as follows: schedule everything that has the same
color at the same time. Since we know that two vertices can't be adjacent if they have the same color,
this means that we can't have any scheduling conflicts. Below we have a coloring of the conflict graph
that satisfies the requirement we set. That is, no two vertices that are adjacent have the same color. In
this coloring, we have used four colors, which means we can assign our seminars in four groups so that
there are no conflicts. Specifically we have:
Group 1: Probabilistic Combinatorics (blue)
Group 2: Ramsey Theory and Operator Theory (yellow)
Group 3: Markov Chains and Algebraic Combinatorics (red)
Group 4: Brownian Motion and Enumerative Combinatorics (green)

In graph theory, the shortest path problem is the problem of finding a path between two vertices (or
nodes) such that the sum of the weights of its constituent edges is minimized. An example is finding
the quickest way to get from one location to another on a road map; in this case, the vertices represent
locations and the edges represent segments of road and are weighted by the time needed to travel that
segment.

Formally, given a weighted graph (that is, a set V of vertices, a set E of edges, and areal-valued weight
function f : E → R), and one element v of V, find a path P from v to a v' of V so that is minimal among
all paths connecting v to v' .

Find the shortest path of the ff graph from node 1 to node 8


CHAPTER-5

TREES

Definition:
A tree is a connected undirected graph with no simple circuits. Since a tree cannot have a circuit, a
tree cannot contain multiple edges or loops. Therefore, any tree must be a simple graph.
Theorem: An undirected graph is a tree if and only if there is a unique simple path between any two
of its vertices. In general, we use trees to represent hierarchical structures.

Example: Are the following graphs trees?

Note: An undirected graph is a tree if and only if there is a unique simple path between any two of its vertices.
In general, we use trees to represent hierarchical structures.

Root & Rooted tree


A rooted tree is a tree in which one vertex has been designated as the root and every edge is directed
away from the root. We often designate a particular vertex of a tree as the root. Since there is a unique
path from the root to each vertex of the graph, we direct each edge away from the root.

Note: A tree with n vertices has (n – 1) edges.

Definition:
A rooted tree is a tree in which one vertex has been designated as the root and every edge is directed
away from the root.
Definition:
If v is a vertex in a rooted tree other than the root, the parent of v is the unique vertex u such that
there is a directed edge from u to v.
− When u is the parent of v, v is called the child of u.
− Vertices with the same parent are called siblings.
− The ancestors of a vertex other than the root are the vertices in the path from the root to this vertex,
excluding the vertex itself and including the root.
The descendants of a vertex v are those vertices that have v as an ancestor.
− A vertex of a tree is called a leaf if it has no children.
− Vertices that have children are called internal vertices.
− If a is a vertex in a tree, then the sub-tree with a as its root is the sub-graph of the tree consisting of a
and its descendants and all edges incident to these descendants.
The level of a vertex v in a rooted tree is the length of the unique path from the root to this vertex.
− The level of the root is defined to be zero.
− The height of a rooted tree is the maximum of the levels of vertices.

A root tree is called an 𝑚 − 𝑎𝑟𝑦 tree if every internal vertex has no more than m children. The tree is
called a full 𝑚 − 𝑎𝑟𝑦 tree if every internal vertex has exactly m children. A full m-ary tree with
𝑚 = 2 is called a binary tree.

Binary Search Tree

Binary Search tree is a binary tree which satisfies the following property −

 X in left sub-tree of vertex V, value(X)≤ value(V)


 Y in right sub-tree of vertex V, value(Y)≥ value(V)

So, the value of all the vertices of the left sub-tree of an internal node V are less than or equal to V and the value
of all the vertices of the right sub-tree of the internal node V are greater than or equal to V

Exercise : create a binary search tree for the sets {34,8,9,2,10,59,35,23,41,92,7,65,26}

Spanning Trees

A spanning tree of a simple graph G is a sub-graph that is a tree and contains every vertex.
A simple graph is connected if and only if it has a spanning tree.

Minimum Spanning Trees


A minimum spanning tree of a weighted simple graph G is a spanning tree with the minimum sum of
weights. The problem here is to find a spanning tree which has the minimum total length.
The Minimal Spanning Tree problem is to select a set of edges so that there is a path between each
node. The sum of the edge lengths is to be minimized.

Steps of the minimal spanning tree solution method


1. Select any starting node (say node one is selected)
2. Select the node closest to the starting node to join the spanning tree.
3. Select the closest node not presently in the spanning tree.
4. Repeat step 3 until all nodes have joined the spanning tree.

minimal spanning tree for


this graph is given below

start say with the left node

This is the final answer the


minimal spanning tree is the
bold segments.

Reverse –Delete algorithm to find minimal spanning tree.

1. Start with all edges


2. Delete the longest edge
3. Continue deleting longest edge as long as all nodes are connected and cycles are not formed.

Example : repeat the above example by reverse-delete

You might also like