0% found this document useful (0 votes)
9 views32 pages

Lecture 11

The document provides a comprehensive overview of directed graphs (digraphs), detailing their structure, properties, and various types of paths and circuits, including Hamiltonian and Eulerian paths. It discusses the concepts of adjacency, incidence matrices, and the representation of digraphs, as well as practical applications such as activity networks and critical path analysis. Additionally, it covers tournaments and the existence of Hamiltonian paths in tournament graphs, along with examples to illustrate these concepts.

Uploaded by

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

Lecture 11

The document provides a comprehensive overview of directed graphs (digraphs), detailing their structure, properties, and various types of paths and circuits, including Hamiltonian and Eulerian paths. It discusses the concepts of adjacency, incidence matrices, and the representation of digraphs, as well as practical applications such as activity networks and critical path analysis. Additionally, it covers tournaments and the existence of Hamiltonian paths in tournament graphs, along with examples to illustrate these concepts.

Uploaded by

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

06/15/2025

Graph Theory
Lecture - 11

Dr. Ilyas Fakhir


06/15/2025
Directed Graph (Digraph)
• A digraph is a finite set v of objects called vertices together with a
finite set of directed edges, or arcs, which are ordered pairs of
vertices.
• It is like a graph except that each edge is allocated a direction - one
vertex is designated a start and the other is a finish.
• An arc directed from start s to finish t is denoted by (s, t ), or simply
st.
• The idea of adjacency needs further consideration in digraphs.
Associated with a vertex x are the two sets
A(x) = {y : (x, y) is an arc}
B(x) = {y : (y, x) is an arc}
• A(x) consists of the vertices after x, and B(x ) means before x . A
vertex x is called a start or source in the digraph if B(x ) is empty and
a finish or sink if A(x) is empty.
2
06/15/2025
• Theindegree and outdegree of a vertex are the
numbers of arcs leading into and leading away from
that vertex respectively, so if multiple arcs are not
allowed, then the indegree and outdegree of v equal
|B(v)| and |A(v)| respectively.
• If
X and Y are any sets of vertices of G, then [X, Y]
consists of all arcs with start in X and finish in Y. If X
or Y has only one element, it is usual to omit the set
brackets in this notation. Observe that, if V is the
vertex set of G, then
[x, A(x)] = [x, V] = set of all arcs leading out of x,
[B(x ), x] = [V, x] = set of all arcs leading into x.
3
06/15/2025
• A directed walk of length n in a directed multigraph is a
sequence (x0, a1 , x1 , a2, x2 , . . ., xn-1 , an , xn) of vertices
and arcs such that ai = (xi – 1, xi).
• A directed path is a directed walk in which the vertices are
all different. Not every path is a directed path. If a
directed path is considered as a digraph, then x 0 is a
source, and is unique, and x n is the unique sink, so we call
x0 and xn the start or source and finish or sink of the path
respectively. We say xi precedes xj (and xj succeeds xi )
when i < j .
• A directed circuit (x1 , x2 , . . ., xn) is a directed walk in
which the first and last vertex are the same. A directed
cycle is a directed circuit in which all of the members are 4
06/15/2025
Example
• A(a ) = {b, c},
A(b) = ø,
A(c) = {b, d},
A(d) = {b},
B(a) = ø,
B(b) = {a, c, d},
B(c) = {a},
B(d) = {c};
a is a source and b is a sink.
[{a, c}, {b, d}] = {ab , cb, cd }.
There are various directed paths,
such as (a, c, d, b), but no directed cycle.
5
Example

06/15/2025
• a, b, c, b, d is a walk,
• a, b, d is a path,
• d , c, b, c, b, d is a closed walk, and
• b, d , c, b is a cycle.
• Note that b, c, b is also a cycle. This is a cycle of
length 2. Such cycles are not possible with undirected
graphs.
• A path or cycle in a directed graph is said to be
Hamiltonian if it visits every node in the graph. For
example, a, b, d , c is the only Hamiltonian path.
• A walk in a directed graph is said to be Eulerian if it
contains every edge. 6
Adjacency Matrix

06/15/2025
• Directedgraphs have adjacency matrices just like
undirected graphs. In the case of a directed graph
G =(V,E), the adjacency matrix AG = {aij} is
defined so that:

• The only difference is that the adjacency matrix


for a directed graph is not necessarily symmetric
(that is, it may be AGT ≠ AG). 7
Representation- Adjacency Matrix
• Example: directed Graph G (V, E)

v u w
u

v 0 1 0

u 0 0 1

v w
w 1 0 0
06/15/2025

Incidence matrices
• Theincidence matrix of the directed graph has one
column for each node of the graph and one row for
each edge of the graph:
• If
an edge runs from node a to node b, the row
corresponding to that edge has -1 in column a and 1
in column b; all other entries in that row are 0.
06/15/2025

Example
Orientations and Tournaments

06/15/2025
• If
G is any graph, it can be converted to a
digraph by assigning a direction to each edge.
This process is called orientation .
• An oriented graph is a digraph that can be
obtained by orienting a graph; in other words, it
is a digraph that never contains both arcs xy
and yx for any pair of vertices x and y.
• If G has e edges, it can be oriented in 2e ways.
• An important practical problem is to orient
edges so that the resulting digraph is strongly
connected. Such an orientation will be called
strong. 11
06/15/2025
• A tournament is an orientation of a complete graph K n.
• Suppose that n players compete in a round-robin tournament
and that for every pair of players u and v, either u beats v or v
beats u.
• The results of a round-robin tournament can be represented with
a tournament graph. This is a directed graph in which the
vertices represent players, and the edges indicate the outcomes
of games. In particular, an edge from u to v indicates that player
u defeated player v. In a round-robin tournament, every pair of
players has a match. Thus, in a tournament graph there is either
an edge from u to v or an edge from v to u (but not both) for
every pair of distinct vertices u and v.

12
Finding a Hamiltonian Path

06/15/2025
in a Tournament Graph
• Inevery round-robin tournament, there exists a
ranking of the players such that each player lost to
the player one position higher. For example, in the
tournament corresponding to Figure in previous
slide, the ranking a > b > d > e > c
satisfies this criterion, because b lost to a, d lost to
b, e lost to d , and c lost to e.
• In
graph terms, proving the existence of such a
ranking amounts to proving that every tournament
graph has a Hamiltonian path.

13
Hamilton Cycles in K4

06/15/2025
• Edges in K4 = (N)(N - 1)/2
• Degree = N -1
• The number of Hamilton circuits in K N is
(N - 1) × (N - 2) ×zx ... × 3 × 2 × 1 = (N - 1)!

14
06/15/2025
Euler Circuit
An Euler circuit is a circuit that uses every edge
of a graph exactly once.
06/15/2025
Euler Circuit
• The graph of Figure (a) has an Euler path but no Euler circuit.
Note that two vertices A and B are of odd degrees 1 and 3
respectively. That means AB can be used to either arrive at
vertex A or leave vertex A but not for both. Thus an Euler
path can be found if we start either from vertex A or from B.
ABCDEB and BCDEBA are two Euler paths. Starting from any
vertex no Euler circuit can be found.
• The graph of Figure (b) has both Euler circuit and Euler path.
ABDEGFDCA is an Euler path and circuit. Note that all
vertices of even degree.
• Euler path but no circuit is possible in Figure (c). Note that all
vertices are not even degree and only two vertices are of odd
degree. The existence of Euler path and circuit depends on
the degree of vertices.
06/15/2025
Euler Circuit
• Show that the graph shown in Figure has no Eulerian circuit
but has a Eulerian trail.

• Eulerian Trail
between u and v.
06/15/2025
Euler Circuit
• Here deg (u) = deg (v) = 3 and deg (w) = 4, deg (x) = 4.
• Since u and v have only two vertices of odd degree, the
graph shown in Figure, does not contain Eulerian circuit, but
the path.
• b – a – c – d – g – f – e is an Eulerian path.
Example

06/15/2025
• Showthat the graphs in Figure below contain no
Eulerian circuit.
Example

06/15/2025
• Whichof the directed graphs in Figure have an
Euler circuit ? Of those that do not, which have an
Euler path ?
Hamiltonian Circuit

06/15/2025
•AHamiltonian circuit is a circuit that visits every
vertex once with no repeats.
• Whichof the graphs given in Figure below is
Hamiltonian circuit. Give the circuits on the graphs
that contain them.
Example

06/15/2025
• Give an example of a graph which is Hamiltonian but not
Eulerian and vice versa.
• Sol. The following graph shown in Figure below is
Hamiltonian but non-Eulerian.


The graph contains a Hamiltonian circuit
v1e 1v2e 2v3e 3v4e 4v5e 5v6e 6v1.
Since the degree of each vertex is not n even the graph is
non-Eulerian.
Example

06/15/2025
• Give an example of a graph which is Hamiltonian but not
Eulerian and vice versa.
• Sol. The graph shown in Figure below is Eulerian but not
Hamiltonian.

• The graph is Eulerian since the degree of each vertex is


even.
Activity Diagram

06/15/2025
• In building a barn one must first build the frame. The
outside walls must be erected before painting, and also
before any inside fittings are installed. The roof must also
be in place before the inside fittings are done. Let us
denote the tasks by:
a: build frame
b: build walls
c: fit roof
d: paint
e: do inside fittings.
• Answer: Then we have:
a must precede b, c, d, e;
b must precede d, e;
c must precede e.
• The unique source a serves as a start; a finish t has been 24
06/15/2025
Critical Paths
• It means a walk (in the directed sense) that covers
each arc exactly once.
Activity Digraph
• We shall set up a digraph, called an activity digraph, to
represent the precedence requirements of a compound
activity. The various tasks are represented by vertices.
• The digraph contains a path in which vertex a precedes
vertex b if and only if task a must
be completed before task b is started.
• For example, in Figure, tasks b and c
must precede task d, but tasks b and c are independent.
25
06/15/2025
• In constructing an activity digraph, it is not always
clear that there is a "starting point" s and an
"endpoint" or "finish" t; so, for convenience, we
formalize the following rules to ensure that the
digraph represents a task with a well-defined start
and finish:
 If the digraph contains more than one source,
define a new vertex s; and add an arc sx to the
digraph whenever x is a source;
 If the digraph contains more than one sink, define a
new vertex t: and add an arc xt to the digraph
whenever x is a sink.
 We refer to this process as initializing the digraph.
26
Critical Path Analysis

06/15/2025
• A major consideration in scheduling a project is the
time needed to perform the various tasks.
• To represent this we associate with each vertex x a
weight w(x).
• Vertex weights are defined similarly to edge weights,
so that w is a mapping from the vertices of a digraph
to the nonnegative real numbers.
• w(x) is called the duration of x, and represents the
time needed to complete the task x.
• A digraph with a weight on the vertices or the arcs is
often called a network, and the network formed by
attaching a weight to an order requirement digraph
is called an activity network. 27
06/15/2025
• Now, critical path analysis, is defined for minimizing the total
time taken to carry out a project.
• We illustrate the technique using an example. Suppose there
are five tasks, called a, b, c, d and e. Task a must precede c;
c must precede e; b must precede d. The durations of the
task are:
a takes 13 minutes.
b takes 25 minutes.
c takes 15 minutes.
d takes 22 minutes.
e takes 27 minutes.

• The activity network, with start s and finish t added, 28


Activity network with earliest start and finish times

06/15/2025
In particular, there is a path sacet from s to t, with
every arc a heavy line. If any task or transition along
this path is delayed, the whole project will be held
up. Such a path is called a critical path.

Finding critical paths is very important in the


elimination of bottlenecks, the design of assembly
lines, and so on. 29
06/15/2025
• To find all critical paths, proceed as follows. First,
calculate the earliest start and finish times of each
task: for S, both times equal 0; for any other task X,
the earliest start time will be the maximum among
all the finish times of prerequisites of X, and the
finish time is the start time plus the duration. An
arc is critical if the finish time of its first vertex
equals the start time of its second vertex. A critical
path is a path from s to t, all of whose arcs are
critical.

30
06/15/2025
Example
• To paint a door. The tasks are as follows (time is shown in minutes):
• j. Remove old paint (75).
• k. Sand the door (30).
• l. Open can and stir paint (4).
• m. Prepare brushes (5).
• n. Clean up paint scrapings (4).
• p . Paint the door (30).
• q. Clean equipment and put brushes away (15).
• j must precede k. j and k must precede n. l, m and n must precede
p. p must precede q . A suitable digraph is shown in Figure

31
Example

06/15/2025

You might also like