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

LEC 14

The document discusses the concepts of connectivity in graphs, including paths, circuits, and the conditions for Euler paths and circuits. It explains how these concepts can be applied to model various real-world problems, such as network communication and routing. Additionally, it provides examples and definitions related to connected components and the conditions for a graph to have Euler paths or circuits.

Uploaded by

7jmfwksw5c
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

LEC 14

The document discusses the concepts of connectivity in graphs, including paths, circuits, and the conditions for Euler paths and circuits. It explains how these concepts can be applied to model various real-world problems, such as network communication and routing. Additionally, it provides examples and definitions related to connected components and the conditions for a graph to have Euler paths or circuits.

Uploaded by

7jmfwksw5c
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 58

LECTURE NO 14

Graphs
Chapter 10
Connectivity
Many problems can be modeled with paths formed by
traveling along the edges of graphs. For instance,

• The problem of determining whether a message


can be sent between two computers using
intermediate links can be studied with a graph
model.
• Problems of efficiently planning routes for mail
delivery, garbage pickup, diagnostics in computer
networks, and so on can be solved using models
that involve paths in graphs.
• Identify connectivity issues in network
infrastructures.
• Design efficient routing algorithms for data transfer
(e.g., in the Internet or local networks).
• Solve problems like shortest path, minimum
Let n be a nonnegative integer and G an undirected graph.
• A path of length n from u to v in G is a sequence of n edges of
G for which there exists a sequence

of vertices such that has, for , the endpoints .

• When the graph is simple, we denote this path by its vertex


sequence (because listing these vertices uniquely determines the
path).
• The path is a circuit if it begins and ends at the same vertex, that
is, if u = v, and has length greater than zero.

• The path or circuit is said to pass through the vertices or


traverse the edges

• A path or circuit is simple if it does not contain the same edge


more than once.
There is considerable variation of terminology concerning
the concepts defined in last slide.

For instance, in some books, the term walk is used instead of path,
where a walk is defined to be an alternating sequence of vertices
and edges of a graph, v0, e1, v1, e2, . . . , vn−1, en, vn, where vi−1
and vi are the endpoints of ei for i = 1, 2, . . . , n. When this
terminology is used, closed walk is used instead of circuit to
indicate a walk that begins and ends at the same vertex, and trail is
used to denote a walk that has no repeated edge (replacing the term
simple path). When this terminology is used, the terminology path
is often used for a trail with no repeated vertices, conflicting with
the terminology in last slide. Because of this variation in
terminology, you will need to make sure which set of definitions
are used in a particular book or article when you read about
traversing edges of a graph.
EXAMPLE 1
In the simple graph shown in Figure 1,

a, d, c, f , e is a simple path of length 4, because {a, d}, {d, c},


{c, f }, and {f, e} are all edges. However, d, e, c, a is not a path,
because {e, c} is not an edge. Note that b, c, f , e, b is a circuit of
length 4 because {b, c}, {c, f }, {f, e}, and {e, b} are edges, and
this path begins and ends at b. The path a, b, e, d, a, b, which is
of length 5, is not simple because it contains the edge {a, b}
twice.
Let n be a nonnegative integer and G a directed graph.

• A path of length n from u to v in G is a sequence of edges of G


such that is associated with is associated with and so on, with
associated with where and . When there are no multiple edges in
the directed graph, this path is denoted by its vertex sequence .
• A path of length greater than zero that begins and ends at the
same vertex is called a circuit or cycle.
• A path or circuit is called simple if it does not contain the same
edge more than once.

Remark: Terminology other than that given abois often used for
the concepts defined there. In particular, the alternative
terminology that uses walk, closed walk, trail, and path (described
earlier) may be used for directed graphs..
• An undirected graph is called connected if there is a path
between every pair of distinct vertices of the graph.

• An undirected graph that is not connected is called


disconnected.

We say that we disconnect a graph when we remove vertices or


edges, or both, to produce a disconnected subgraph.

Thus, any two computers in the network can communicate if and


only if the graph of this network is connected.
EXAMPLE 4
The graph in Figure 2 is connected, because for every pair of distinct
vertices there is a path between them (the reader should verify this).
However, the graph in Figure 2 is not connected. For instance, there
is no path in between vertices a and d.
THEOREM 1
There is a simple path between every pair of distinct vertices of a
connected undirected graph.

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.
That is, a connected component of a graph G is a maximal
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.
EXAMPLE 5
What are the connected components of the graph H shown in
Figure 3?
Solution:
The graph H is the union of three disjoint connected subgraphs ,
shown in Figure 3. These three subgraphs are the connected
components of H.
EXAMPLE 6
Connected Components of Call Graphs Two vertices x and y
are in the same component of a telephone call graph (see
Example 4 in Section 10.1) when there is a sequence of
telephone calls beginning at x and ending at y. When a call graph
for telephone calls made during a particular day in the AT&T
network was analyzed, this graph was found to have 53,767,087
vertices, more than 170 million edges, and more than 3.7 million
connected components.
Most of these components were small; approximately three-
fourths consisted of two vertices representing pairs of telephone
numbers that called only each other. This graph has one huge
connected component with 44,989,297 vertices comprising more
than 80% of the total. Furthermore, every vertex in this
component can be linked to any other vertex by a chain of no
more than 20 calls.
DEFINITION 4

A directed graph is strongly connected if there is a path


from a to b and from b to a whenever a and b are vertices in
the graph.

DEFINITION 5
A directed graph is weakly connected if there is a path
between every two vertices in the underlying undirected graph.
EXAMPLE 10
Are the directed graphs G and H shown in Figure 5 strongly
connected? Are they weakly connected?
Solution:
G is strongly connected because there is a path between any two
vertices in this directed graph (the reader should verify this). Hence,
G is also weakly connected. The graph H is not strongly connected.
There is no directed path from a to b in this graph. However, H is
weakly connected, because there is a path between any two vertices
in the underlying undirected graph of H (the reader should verify
this)
Paths and Isomorphism

There are several ways that paths and circuits can help determine
whether two graphs are isomorphic.

For example,

• The existence of a simple circuit of a particular length is a


useful invariant that can be used to show that two graphs are
not isomorphic.

• In addition, paths can be used to construct mappings that may


be isomorphisms.
EXAMPLE 13
Determine whether the graphs G and H shown in Figure 6 are
isomorphic.
Solution:
Both G and H have six vertices and eight edges. Each has four
vertices of degree three, and two vertices of degree two. So, the
three invariants number of vertices, number of edges, and
degrees of vertices all agree for the two graphs. However, H has
a simple circuit of length three, namely, , whereas G has no
simple circuit of length three, as can be determined by inspection
(all simple circuits in G have length at least four). Because the
existence of a simple circuit of length three is an isomorphic
invariant, G and H are not isomorphic.
EXAMPLE 14
Determine whether the graphs G and H shown in Figure 7 are
isomorphic.
Solution:
Both G and H have five vertices and six edges, both have two
vertices of degree three and three vertices of degree two, and both
have a simple circuit of length three, a simple circuit of length four,
and a simple circuit of length five. Because all these isomorphic
invariants agree, G and H may be isomorphic.
Counting Paths Between Vertices

THEOREM 2

Let G be a graph with adjacency matrix A with respect to the


ordering of the vertices of the graph (with directed or undirected
edges, with multiple edges and loops allowed). The number of
different paths of length r from , where r is a positive integer,
equals the (i, j )th
EXAMPLE 15
How many paths of length four are there from a to d in the simple
graph G in Figure 8?
Solution:
The adjacency matrix of G (ordering the vertices as a, b, c, d) is
given below. Hence, the number of paths of length four from a to d
is the th entry of .
there are exactly eight paths of length four from a to d.
By inspection of the graph, we see that

• a, b, a, b, d;
• a, b, a, c, d;
• a, b, d, b, d;
• a, b, d, c, d;
• a, c, a, b, d;
• a, c, a, c, d;
• a, c, d, b, d;
• a, c, d, c, d

are the eight paths of length four from a to d.


• Can we travel along the edges of a graph starting at a vertex
and returning to it by traversing each edge of the graph exactly
once?
• Similarly, can we travel along the edges of a graph starting at a
vertex and returning to it while visiting each vertex of the
graph exactly once?

Although these questions seem to be similar, the first question,


which asks whether a graph has an Euler circuit, can be easily
answered simply by examining the degrees of the vertices of the
graph, while the second question, which asks whether a graph has
a Hamilton circuit, is quite difficult to solve for most graphs.
Euler Paths and Circuits
The town of Königsberg, Prussia (now called Kaliningrad and part of
the Russian republic), was divided into four sections by the branches
of the Pregel River. These four sections included the two regions on
the banks of the Pregel, Kneiph of Island, and the region between the
two branches of the Pregel. In the eighteenth century seven bridges
connected these regions. The townspeople took long walks through
town on Sundays. They wondered whether it was possible to start at
some location in the town, travel across all the bridges once without
crossing any bridge twice, and return to the starting point.
The Swiss mathematician Leonhard Euler solved this problem. His
solution, published in 1736, may be the first use of graph theory. Euler
studied this problem using the multigraph obtained when the four
regions are represented by vertices and the bridges by edges. The
problem of traveling across every bridge without crossing any bridge
more than once can be rephrased in terms of this model. The question
becomes: Is there a simple circuit in this multigraph that contains
every edge?
DEFINITION 1
An Euler circuit in a graph G is a simple circuit containing every
edge of G.
An Euler path in G is a simple path containing every edge of G.
EXAMPLE 1
Which of the undirected graphs in Figure 3 have an Euler circuit?
Of those that do not, which have an Euler path?
EXAMPLE 2
Which of the directed graphs in Figure 4 have an Euler circuit?
Of those that do not, which have an Euler path?
Solution:
The graph has an Euler circuit, for example, a, g, c, b, g, e, d, f,
a. Neither nor has an Euler circuit (as the reader should verify).
has an Euler path, namely, c, a, b, c, d, b, but does not (as the
reader should verify).
NECESSARY AND SUFFICIENT CONDITIONS FOR
EULER CIRCUITS AND PATHS

There are simple criteria for determining whether a multigraph


has an Euler circuit or an Euler path. Euler discovered them when
he solved the famous Königsberg bridge problem.

• We will assume that all graphs discussed in this section have a


finite number of vertices and edges.
• What can we say if a connected multigraph has an Euler
circuit?
• What we can show is that every vertex must have even degree.
To do this, first note that an Euler circuit begins with a vertex a
and continues with an edge incident with a, say {a, b}. The
edge {a, b} contributes one to deg(a).
Each time the circuit passes through a vertex it contributes two to
the vertex’s degree, because the circuit enters via an edge incident
with this vertex and leaves via another such edge.
NECESSARY AND SUFFICIENT CONDITIONS FOR
EULER CIRCUITS AND PATHS
• Finally, the circuit terminates where it started, contributing
one to deg(a). Therefore, deg(a) must be even, because the
circuit contributes one when it begins, one when it ends, and
two every time it passes through a (if it ever does).
• A vertex other than a has even degree because the circuit
contributes two to its degree each time it passes through the
vertex.
• We conclude that if a connected graph has an Euler circuit,
then every vertex must have even degree.
• Is this necessary condition for the existence of an Euler
circuit also sufficient? That is, must an Euler circuit exist in a
connected multigraph if all vertices have even degree? This
question can be settled affirmatively with a construction.
THEOREM 1 A connected multigraph with at least two
vertices has an Euler circuit if and only if each of its vertices has
even degree.
EXAMPLE 3
Many puzzles ask you to draw a picture in a continuous motion
without lifting a pencil so that no part of the picture is retraced. We
can solve such puzzles using Euler circuits and paths. For example,
can Mohammed’s scimitars, shown in Figure 6, be drawn in this
way, where the drawing begins and ends at the same point?
Solution:
We can solve this problem because the graph G shown in Figure 6
has an Euler circuit. It has such a circuit because all its vertices
have even degree. First, we form the circuit a, b, d, c, b, e, i, f, e,
a. We obtain the subgraph H by deleting the edges in this circuit
and all vertices that become isolated when these edges are
removed.
Then we form the circuit d, g, h, j, i, h, k, g, f, d in H. After
forming this circuit we have used all edges in G. Splicing this new
circuit into the first circuit at the appropriate place produces the
Euler circuit a, b, d, g, h, j, i, h, k, g, f, d, c, b, e, i, f, e, a. This
circuit gives a way to draw the scimitars without lifting the pencil
or retracing part of the picture.
THEOREM 2
A connected multigraph has an Euler path but not an Euler
circuit if and only if it has exactly two vertices of odd degree.
EXAMPLE 4
Which graphs shown in Figure 7 have an Euler path?
Solution:
contains exactly two vertices of odd degree, namely, b and d.
Hence, it has an Euler path that must have b and d as its endpoints.
One such Euler path is d, a, b, c, d, b. Similarly, has exactly two
vertices of odd degree, namely, b and d. So it has an Euler path that
must have b and d as endpoints. One such Euler path is b, a, g, f, e,
d, c, g, b, c, f, d. has no Euler path because it has six vertices of odd
degree.
Returning to eighteenth-century Königsberg,
• Is it possible to start at some point in the
town, travel across all the bridges, and end up
at some other point in town?

This question can be answered by determining


whether there is an Euler path in the multigraph
representing the bridges in Königsberg.

• Because there are four vertices of odd degree


in this multigraph, there is no Euler path, so
such a trip is impossible.
APPLICATIONS OF EULER PATHS AND
CIRCUITS
Euler paths and circuits can be used to solve many practical
problems. For example,
• Many applications ask for a path or circuit that traverses each
street in a neighborhood, each road in a transportation network,
each connection in a utility grid, or each link in a
communications network exactly once.
• Finding an Euler path or circuit in the appropriate graph model
can solve such problems.
For example,
• If a postman can find an Euler path in the graph that represents
the streets the postman needs to cover, this path produces a route
that traverses each street of the route exactly once.
• Euler circuits and paths are applied is in the layout of circuits, in
network multicasting, and in molecular biology, where Euler
paths are used in the sequencing of DNA.
Hamilton Paths and Circuits
We have developed necessary and sufficient conditions for the
existence of paths and circuits that contain every edge of a
multigraph exactly once. Can we do the same for simple paths and
circuits that contain every vertex of the graph exactly once?
DEFINITION 2
A simple path in a graph G that passes through every vertex exactly
once is called a Hamilton path,
and a simple circuit in a graph G that passes through every vertex
exactly once is called a Hamilton circuit.

That is, the simple path in the graph G = (V ,E) is a Hamilton path if
and for
, and the simple circuit , (with n > 0) is a Hamilton circuit if is a
Hamilton path.
EXAMPLE 5 Which of the simple graphs in Figure 10 have a
Hamilton circuit or, if not, a Hamilton path?
Solution: has a Hamilton circuit: a, b, c, d, e, a. There is no
Hamilton circuit in (this can be seen by noting that any circuit
containing every vertex must contain the edge {a, b} twice), but
does have a Hamilton path, namely, a, b, c, d. has neither a
Hamilton circuit nor a Hamilton path, because any path containing
all vertices must contain one of the edges {a, b}, {e, f }, and {c, d}
more than once.
CONDITIONS FORTHE EXISTENCE OF HAMILTON
CIRCUITS
Is there a simple way to determine whether a graph has a Hamilton
circuit or path?
Surprisingly, there are no known simple necessary and sufficient
criteria for the existence of Hamilton circuits. However, many
theorems are known that give sufficient conditions for the existence of
Hamilton circuits. Also, certain properties can be used to show that a
graph has no Hamilton circuit.
For instance, a graph with a vertex of degree one cannot have a
Hamilton circuit, because in a Hamilton circuit, each vertex is incident
with two edges in the circuit. Moreover, if a vertex in the graph has
degree two, then both edges that are incident with this vertex must be
part of any Hamilton circuit. Also, note that when a Hamilton circuit is
being constructed and this circuit has passed through a vertex, then all
remaining edges incident with this vertex, other than the two used in
the circuit, can be removed from consideration. Furthermore, a
Hamilton circuit cannot contain a smaller circuit within it.
EXAMPLE 6
Show that neither graph displayed in Figure 11 has a Hamilton
circuit.
Solution:
There is no Hamilton circuit in G because G has a vertex of degree
one, namely, e. Now consider H. Because the degrees of the vertices
a, b, d, and e are all two, every edge incident with these vertices
must be part of any Hamilton circuit. It is now easy to see that no
Hamilton circuit can exist in H, for any Hamilton circuit would have
to contain four edges incident with c, which is impossible.
Although no useful necessary and sufficient conditions for the
existence of Hamilton circuits are known, quite a few sufficient
conditions have been found.
Note that the more edges a graph has, the more likely it is to have a
Hamilton circuit.
Furthermore, adding edges (but not vertices) to a graph with a
Hamilton circuit produces a graph with the same Hamilton circuit.
So as we add edges to a graph, especially when we make sure to
add edges to each vertex, we make it increasingly likely that a
Hamilton circuit exists in this graph.
Consequently, we would expect there to be sufficient conditions for
the existence of Hamilton circuits that depend on the degrees of
vertices being sufficiently large. We state two of the most
important sufficient conditions here.
THEOREM 3 DIRAC’S THEOREM
If G is a simple graph with n vertices with n ≥ 3 such that the
degree of every vertex in G is at least n/2, then G has a Hamilton
circuit.

THEOREM 4 ORE’S THEOREM If G is a simple graph with n


vertices with n ≥ 3 such that deg(u) + deg(v) ≥ n for every pair of
nonadjacent vertices u and v in G, then G has a Hamilton circuit.

Both Ore’s theorem and Dirac’s theorem provide sufficient


conditions for a connected simple graph to have a Hamilton
circuit. However, these theorems do not provide necessary
conditions for the existence of a Hamilton circuit.
Applications of Hamilton Circuits
Hamilton paths and circuits can be used to solve practical
problems. For example, many applications
ask for a path or circuit that visits each road intersection in a
city, each place pipelines intersect in a utility grid, or each node
in a communications network exactly once.

Finding a Hamilton path or circuit in the appropriate graph


model can solve such problems. The famous traveling
salesperson problem or TSP (also known in older literature as
the traveling salesman problem) asks for the shortest route a
traveling salesperson should take to visit a set of cities. This
problem reduces to finding a Hamilton circuit in a complete
graph such that the total weight of its edges is as small as
possible

You might also like