0% found this document useful (0 votes)
68 views42 pages

Graph Theory & Its Formal Aspects: Lecture 3-4

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1/ 42

Graph Theory & Its Formal

Aspects
1
Lecture 3-
4
2

Königsberg Bridge Problem


3
In the 18th century a city named
Königsberg in east Prussia (Europe)
there flowed a river viz., Pregel
which divided the city into four
parts. Two
of these parts were on the banks of
the river and the other two parts
were on islands. These parts were
connected with each other through
seven bridges.
The citizen of the city seems to have
posed the following problem:

By starting at any four land areas, can


we return to that area after
crossing each of the seven bridges
exactly once?

This problem now known as the


Königsberg Bridge Problem,
remained
In the year 1736, Euler analyzed the
problem with the help of a graph and
gave the solution. This was indeed
the starting point for the
development of graph theory.
Denote the land areas of the city by
v1, v2, v3 and v4 where v1 and v2 are
the banks of the river and v3 and v4
are the islands. Construct a
7
graph by treating these four land
areas as four vertices and the seven
bridges connecting them as seven
edges. Note that in this graph not all
the vertices are of even degree and
therefore the graph is not Euler
graph. This means
that there does not exist a closed
walk that contains all the edges
(exactly once).
8

v
1

v
3 v
4
v
2
9

This amounts to saying that it is not


possible to walk over each of the
seven bridges exactly once and
return to the starting point.

Thus, the solution to the


Königsberg bridge problem
remains Unsolved.
Agenda –
Graphs
 Graph basics and definitions
 Vertices/nodes, edges, adjacency,
incidence
 Degree, in-degree, out-degree
 isomorphism
 Adjacency matrices
 Types of Graphs
 Trees
 Undirected graphs
 Simple graphs, Multigraphs, Pseudographs
 Digraphs, Directed multigraph
 Bipartite L23
11 Uses of Graph Theory in
CS
 Car navigation system
 Efficient database
 Build a bot to retrieve info off
WWW
 Representing computational
models
12 Graphs –Intuitive
Notion
 A graph is a bunch of vertices (or
nodes) represented by circles which
are connected by edges, represented
by line segments
 A graph G (sometimes called
networks) consists of two things:
(i)A set V = V(G) whose elements are
called vertices, points, or nodes of
G.
(ii)A set E = E(G) of unordered pairs of L23
distinct vertices called edges of G.
1 Fundamentals of
3
Graphs
 A graph with finite numbers of vertices and edges is called a
finite graph otherwise infinite graph.
 No. of vertices in a finite graph is called order of the graph.
 No. of edges in a finite a graph is called size of the graph.
 A graph of order n and size m is called a (n, m) graph.
 A graph which contains neither self-loop nor parallel edges I
s called a simple graph.
 A graph which contains parallel edges but no self-loop Is
called a multiple graph.
 A graph which contains parallel edges and self-loop is called
a general graph.
1  In many situations, the names assigned to vertices are
4
inconsequential. In such situations, we do not assign
any names to the vertices. Such a graph is called
un-labelled graph.
 If the names are assigned to the vertices of a graph
the graph is called labeled graph
 Adjacent edges
Two non-parallel edges are said to be adjacent edges
if they are incident on a common vertex (i.e., if they
have a vertex in common).
 Adjacent vertices
Two non-parallel vertices are said to be adjacent
vertices
(or neighbors) if there is an edge joining them.
1  Degree of a vertex
5
If v is a vertex of a graph, then the number of edges incident on v
(i.e., the number of edges that join v to other vertices in the graph)
with self- loops counted twice, is called the degree of the vertex v.
It is denoted by deg(v) or d(v).
 A vertex is said to be odd or even according as d(v) is odd or
even.

 Wheel
graph
 The graph (slide no. 15) contains 9 vertices of
1
6 which one is at the centre and the remaining
8 are on the circumference. The degree of
the vertex at the centre is 8 and the degree
of vertices on the circumference are 3 each.
This graph is called Wheel graph of order 9
denoted by W9.
 In general, a wheel graph of order n is
denoted by Wn. In this graph, one vertex lies
at the centre of a circle (wheel) and n-1
vertices lie on the circumference; the degree
of the vertex at the centre is n-1, the degree
of the remaining vertices are 3 each and the
number of edges is 2(n-
17
 Isolated vertex
A vertex in a graph, which is not an end vertex of any edge is
called an isolated vertex
 Pendant vertex
A vertex of degree 1 is called a pendant vertex. An edge incident
on a pendant vertex is called a pendant edge.
 Regular graph
A graph in which all the vertices are of the same degree is
called a regular graph.
 Max VS min degree
1
8
 For the graphs given below δ(G)=2,
Δ(G)=3.
v2
v1
v1 v3

v2 v4
v3 v4
 A regular graph in which all vertices are of degree
k is called k-regular graph. Obviously for a k-regular
graph δ=Δ=k.
 Complete
graph
1 A simple graph in which there is an edge between every
9 pair of vertices is called a complete graph (or full graph).
 In other words, a complete graph is a simple graph in which
every pair of distinct vertices are adjacent. A complete graph
is denoted by Kn

K5: Kuratowski’s first


Graph
s
 Vertices “u” and “v” are said to be
adjacent If there is an edge e = {u, v}
joining them.
 The edge “e” is said to be incident on each
of Its vertices u and v.
Multigraphs

 The edges “e4” and “е5” are called multiple edges


since they connect the same endpoints, and the
edge “e6” is called a loop since its endpoints are the
same single vertex.
Paths and
connectivity
 A path in a graph G consists of an
alternating sequence of vertices and edges
of the form;
v0, e1, v1, e2, v2, ………., en-1, vn-1 , еn,
vn
 where each edge ei contains the vertices
vi-1
and vi (which appear on the sides of edge ei
in the sequence).
 The path is said to be closed if v0 = vn.
Otherwise, we say the path is from v0 to vn, or
between v0 and vn, or connects v0 to vn. A
simple path is a path in which all vertices are
Paths
(continued)
 Example: In the simple graph here:
a, d, c, f, e is a simple path of length 4.
d, e, c, a is not a path because e is not connected to c.
b, c, f, e, b is a circuit of length 4.
a, b, e, d, a, b is a path of length 5, but it is not a simple path.
Connectedness in Undirected Graphs
An undirected graph is called connected if
there is a path between every pair of vertices.
An undirected graph that is not connected is
called disconnected.
The graph given below is not connected
because there is no path between vertices a
and f, for example.
Connected Components
 A connected component of a graph G is a
connected subgraph of G that is not a proper
subgraph of another connected subgraph of G. A
graph G that is not connected has two or more
connected components that are disjoint and have
G as their union.
 The graph H is the union of three disjoint subgraphs H1, H2, and H3,
none of which are proper subgraphs of a larger connected subgraph
of G. These three subgraphs are the connected components of H.
Connectedness in Directed
Graphs
 A directed graph is strongly connected if there
Is a path from a to b and a path from b to a
whenever a and b are vertices in the graph.
 A directed graph is weakly connected if
there Is a path between a and b but not from
b to a.
Connectedness in Directed Graphs
(contd.)
 G is strongly connected because there is a path
between any two vertices in the directed graph. The
graph H is not strongly connected, since there is no
directed path from a to b, but it is weakly connected.
The bridge of Konigsberg;
traversable graph
• A graph is said to be traversable if it can
be drawn without any breaks in the curve
and without repeating any edges.
• If there is a path which includes all vertices
and uses each edge exactly once (no edge
is used twice), will be called a traversable
trail.
Konigsberg bridge
Eulerian circuit vs Hamiltonian
circuit
 A Hamiltonian circuit in a graph G, named
after the nineteenth-century Irish
mathematician William Hamilton A805-1865),
is a closed path that visits every vertex in G
exactly once.
 Eulerian circuit traverses every edge
exactly once, but may repeat vertices,
while a Hamiltonian circuit visits each
vertex exactly once but may repeat
edges.
Complete, regular and bipartite
graphs
 A graph G is said to be complete if every vertex
in G is connected to every other vertex in G.
 A graph G is regular of degree k or k-regular if
every vertex has degree k.
 A graph G is said to be bipartite if its vertices V
can be partitioned into two subsets M and N
such that each edge of G connects a vertex of
M to a vertex of N.
 By a complete bipartite graph, we mean that
each vertex of M is connected to each vertex
of N.
Example
s

K4 complete, 3-regular and G(2,3) bipartite


graphs
3 Platonic
7
graphs
 Of interest among the regular graphs are the Platonic graphs, formed
from the vertices and edges of the five regular (Platonic) solids - the
tetrahedron, octahedron, cube, icosahedron (20 faces) and
dodecahedron (12 faces).
38
Directed graphs or
digraphs
 Directed graphs are graphs in which the
edges are one-way or arrows. A directed
graph G or digraph consists of two things:
(i) A set V whose elements are called vertices,
nodes, or points.
(ii) A set of ordered pairs (u, v) of vertices
called arcs or directed edges.
39
Example
40
Degrees of
digraph
 The outdegree of a vertex v of G, written
outdeg(v), is the number of arcs beginning at
v, and the indegree of v, written indeg(v), is
the number of arcs ending at v. each arc
begins and ends at a vertex.
 Theorem: The sum of the outdegrees of the
vertices of a digraph G equals the sum of
the indegrees of the vertices, which equals
the number of edges in G.
41
Adjacency matrix of
digraph

No. of 1’s in A is X Y Z W
equal to no. of X
edges, row total Y
and col. gives the
Z
indegree and
W
outdegree, resp.
42
Connectivity of
 digraphs
There are three types of connectivity in a directed
graph
G:
(i) G is strongly connected or strong if, for any pair of
vertices u and v in G, there is a path from u to v; and a
path from v to u, that is, each is reachable from the
other.
(ii) G is unilaterally connected or unilateral if, for any pair of
vertices u and v in G, there is a path from u to v or a path
from v to u, that is, one of them is reachable from the
other.
(iii) G is weakly connected or weak if there is a undirected
path between any pair of vertices u and v in G.
43
Digraphs and
relations
 The relation R is reflexive if every node has
a loop.
 The relations R is symmetric if arcs
are bidirectional.
 The relation R is transitive if for any sequence
of consecutive arcs, there is a single arc from
the first to the last node.
Graphical Properties of Relations

Reflexive Symmetric

Transitive

You might also like