Professional Documents
Culture Documents
09 Lecture
09 Lecture
Nurlan Ismailov
nurlan.ismailov@astanait.edu.kz
Astana IT University
June 4, 2020
Many real problems, when translated to questions about graphs, inquire about
the possibility of working through a graph in a particular way. Although our
primary interest is in graphs, the definitions and results of this lecture are
stated for pseudographs, since they apply equally, and with few additional
complications, in the more general setting.
Definition
A walk in a pseudograph is an alternating sequence of vertices and edges,
beginning and ending with a vertex, in which edge is incident with the
vertex immediately preceding it and the vertex immediately following it.
The length of a walk is the number of edges in it.
A walk is closed if the first vertex is the same as the last and otherwise
open.
B D
E F
Definition
An Eulerian circuit in a pseudograph is a circuit that contains every vertex
and every edge. A pseudograph is Eulerian if it contains an Eulerian circuit.
B D
E F
The circuit ABCEF CDA is not Eulerian because it does not contain the edge
BD. As we will soon see, this graph possesses no Eulerian circuit; it is not an
Eulerian graph.
Nurlan Ismailov nurlan.ismailov@astanait.edu.kz
Discrete Mathematics
(Astana IT University)
Lecture 9 - Paths and Circuits June 4, 2020 5 / 32
The circuit ABCDEF GHF A is not Eulerian since while it encompasses all
vertices, it omits four edges.
H A
B
C
F
G E D
Definition
A pseudograph is connected if and only if there exists a walk between any two
vertices.
B
E
C
Theorem 1 (Euler)
A pseudograph (with at least two vertices) is Eulerian if and only if it is
connected and every vertex is even.
Theorem 2 (Euler)
A pseudograph G possesses an Eulerian trail between two (different) vertices u
and v if and only if it is connected and all vertices except u and v are even.
B D
E F
Answer: No, it is not Eulerian, because not all vertices are even; for example,
deg B = 3.
An Eulerian circuit passes through every edge of a graph exactly once. Now
we discuss circuits that passes though each vertex of a graph exactly once.
Unlike the situation in Eulerian case, the definitions and results here apply
only to graphs, not a pseudograph.
E A B
C C
B
D D E
G1 G2
Suppose that G2 has a cycle H that contains every vertex. Then H will
contain A, which we note is a vertex of degree 2. Since we cannot enter and
leave A on the same edge (edges of a cycle are distinct), it follows that both
edges incident with A have to be part of H. In particular, edge CA is in H.
The same argument applied to B shows that CB is part of H and, similarly.
CD and CE are in H. All four edges incident with C are part of H. This
situation is impossible, however: since H is a cycle, vertex C can appear only
once unless the cycle begins and ends at C. In either case, since H cannot use
the same edge twice, exactly two edges incident with C can be part of H.
A B
C
D E
There are, however, some properties of cycles that are helpful in trying to find
Hamiltonian cycles and that sometimes allow us to conclude that a particular
graph is not Hamiltonian.
Questions
Is this graph Hamiltonian?
Is it True
or False that “The graph is
not Hamiltonian because it
contains the cycle GHIG”?
As a deeper
application of the properties of Hamiltonian
graphs described above, we introduce
a famous graph named after the Danish
mathematician Julius Peterson (1839-1910).
Theorem (Dirac)
n
If a graph G has n ≥ 3 vertices and every vertex has degree at least 2, then G
is Hamiltonian.
One can find the proof of the theorem in the main textbook.
n n−1
5. Show that Dirac’s Theorem is false if 2 is replaced by 2 in its statement.
To write an algorithm that requires the input of a graph, we first must decide
how to code the pertinent information that describes a graph.
Definition
Let G be a graph with n vertices labeled v1 , v2 , . . . , vn . For each i and j with
1 ≤ i, j ≤ n, define
1 if vi vj is an edge
aij =
0 if vi vj is not an edge.
Let G be a graph
v1 v2 v3
0 0 0 1 0
0 0 0 1 1
v4 v5
0
then its adjacency matrix A is 0 0 0 0 .
1 1 0 0 1
0 1 0 1 0
The adjacency matrix of the complete bipartite graph on the set
V1 = {v1 , v2 } and V2 = {v3 , v4 , v5 } is
0 0 1 1 1
0 0 1 1 1
1 1 0 0 0
1 1 0 0 0
1 1 0 0 0
The adjacency matrix is symmetric, that is, aij = aji for all i, j.
Two graphs are isomorphic if and only if their vertices can be labeled in
such a way that the corresponding adjacency matrices are equal.
For example, if row i of A were the vector [0, 0, 1, 0, 1, 1, 0] and the column j
the vector [1, 1, 1, 0, 0, 1, 0], then the dot product (row i)·(row j)=2,
corresponding to the two coordinates (third and sixth) where each vectors has
a 1.
How does it happen that a row and a column have a 1 in the same coordinate?
In our example, row i and column j each have third coordinate 1; this
corresponds to the fact that there is an edge in the graph between vi and v3
and an edge between vj and v3 . There is a walk in the graph from vi to vj
that uses edges, vi v3 vj . The dot product of row i and column j is therefore
the number of walks of length 2 from vi and vj .
The case k > 2 can be justified as in the case k = 2.
Nurlan Ismailov nurlan.ismailov@astanait.edu.kz
Discrete Mathematics
(Astana IT University)
Lecture 9 - Paths and Circuits June 4, 2020 28 / 32
Example
Consider the graph
v1 v2 v3
v4 v5
Then
1 1 0 0 1
1 2 0 1 1
A2 =
0 0 0 0 0 .
0 1 0 3 1
1 1 0 1 2
The (4, 5) entry of A3 is 4. Thus, there are four walks of length 3 from v4 to
v5 in the graph.
They are
v4 v5 v2 v5 , v4 v1 v4 v5 , v4 v5 v4 v5 and v4 v2 v4 v5 .
v1 v2 v3
v4 v5
8. Label the vertices of Km,n so that adjacency matrix has an especially nice
form.
10. Reading the section 10.4 Shortest Path Algorithm (about Dijkstra’s
Algorithm and the Floyd-Marshall Algorithm) in the main textbook.