0% found this document useful (0 votes)
73 views9 pages

Lecture 8: Paths, Cycles and Connectedness

The document summarizes key concepts related to paths, cycles, and connectivity in graphs. It defines paths, cycles, walks, and trails. It describes algorithms for graph traversal including breadth-first search and depth-first search. It also defines connected graphs and discusses components, cut edges, cut vertices, distances in graphs including diameter and radius. Finally, it presents proofs of theorems related to cut edges, bipartite graphs, and the relationship between odd cycles and bipartiteness.

Uploaded by

BHUSHAN VERMA
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)
73 views9 pages

Lecture 8: Paths, Cycles and Connectedness

The document summarizes key concepts related to paths, cycles, and connectivity in graphs. It defines paths, cycles, walks, and trails. It describes algorithms for graph traversal including breadth-first search and depth-first search. It also defines connected graphs and discusses components, cut edges, cut vertices, distances in graphs including diameter and radius. Finally, it presents proofs of theorems related to cut edges, bipartite graphs, and the relationship between odd cycles and bipartiteness.

Uploaded by

BHUSHAN VERMA
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/ 9

Discrete Mathematics August 20, 2014

Lecture 8: PATHS, CYCLES AND CONNECTEDNESS


Instructor: Sushmita Ruj Scribe: Ishan Sahu & Arnab Biswas

1 Paths, Cycles and Connectedness


1.1 Paths and Cycles
1. Paths

Definition 1.1 A walk is a sequence of vertices and edges.

e.g. In Figure 1 v1 e1 v2 e2 v3 , v1 e1 v2 e2 v3 e3 v4 are among the walks present in the graph


G1.

Definition 1.2 A path is a walk with no repeated vertices.

e.g. In Figure 2 v1 e1 v2 e2 v3 e3 v4 is a path whereas v1 e1 v2 e4 v5 e5 v4 e3 v3 e2 v2 is not a path


in graph G2.

Definition 1.3 A trail is a walk with no repeated edges.

e.g. In Figure 2 v1 e1 v2 e4 v5 e5 v4 e3 v3 e2 v2 e6 v6 is a trail.


A walk or trail is closed if the first vertex is equal to the last vertex.
2. Cycles

Definition 1.4 A cycle is a closed trail in which the “first vertex = last vertex” is
the only vertex that is repeated.

e.g. Figure 3 shows cycles with three and four vertices.


A graph is acyclic if it does not contain a cycle.

Figure 1: Graph G1

8-1
Figure 2: Graph G2

Figure 3: C3 : Cycle with three vertices; C4 : Cycle with four vertices

1.2 Graph Traversal


The goal of the graph traversal is to visit all the nodes of a given graph in a particular
manner. The two popular algorithms are breadth first search and depth first search.

1. Breadth First Search (BFS)


BFS visits nodes in the order of their distance from the starting node. It traverses
the breadth of any particular path before exploring its depth. [2] [5]

Algorithm [2]

• Input: An unweighted graph and a start vertex u.

8-2
• Idea: Maintain a set R of vertices that have been reached but not searched and a
set S of vertices that have been searched. The set R is maintained as a First-In
First-Out list (queue), so the first vertices found are the first vertices explored.
• Initialization: R = u, S = Φ, d(u, u) = 0
• Iteration: As long as R 6= Φ, we search from the first vertex v of R. The neigh-
bours of v not in S∪R are added to the back of R and assigned distance d(u, v)+1,
and then v is removed from the front of R and placed in S.
e.g. In the graph G3 in Figure 4 one breadth-first search from u finds the vertices
in the order u, a, g, b, f, c, d, e.

2. Depth First Search (DFS)


DFS visits the child nodes before visiting the sibling nodes; that is, it traverses the
depth of any particular path before exploring its breadth. [5] In DFS, we explore al-
ways from the most recently discovered vertex that has unexplored edges. We maintain
the list of vertices to be searched as a Last-In First-Out “stack” rather than a queue. [2]

Algorithm [4]

• Input: An unweighted graph and a start vertex u.


• Procedure: Maintain a set R of vertices that have been reached but not discovered
and a set S of vertices that have been discovered. The set R is maintained as a
Last-In First-Out stack, so the most recently found vertiex is the first vertex to
be explored. Add u to R. As long as R 6= Φ, following steps are repeated:
(a) Take out the last-in vertex v.
(b) If v ∈
/ S then place it in S and add all adjacent vertices w, if present, to R.
e.g. In the graph G3 in Figure 4 one depth-first search from u finds the vertices
in the order u, a, b, c, d, e, f, g.

Figure 4: Graph G3

8-3
Question: How to find whether a cycle is present in the graph?
Answer: Traverse the graph keeping track of vertices visited. If a vertex is reached again,
a cycle is present.

1.3 Connections in Graphs


1. Connected Graphs

Definition 1.5 A graph is connected if it has a u-v path for every pair of vertices.
u, v ∈ V (G)

Definition 1.6 The components of a graph are its maximal connected sub-
graphs.

Definition 1.7 A cut-edge(cut-vertex) is an edge(vertex), which when removed


increases the number of components.

e.g. Figure 5 shows a connected graph with a cut-edge and the components formed
after its removal.

2. Distances in Graphs

Definition 1.8 The distance between a pair of vertices is the length of the shortest
path between them.

Definition 1.9 The diameter of a graph G is the longest shortest path over all the
vertices of G.

e.g. Figure 6 shows a graph with diameter 4.

Definition 1.10 The eccentricity of a vertex v, denoted by (v) is the maximum


distance from v to any other vertex in the graph.

Definition 1.11 The radius of a graph G is the minimum of the eccentricities of its
vertices.

e.g. Figure 7 shows a graph with radius 2.

8-4
Figure 5: (a) A connected graph with a cut-edge vx vy ; (b), (c) The two components after
removing the cut-edge.

Figure 6: A graph with diameter 4. i − b, j − d have the longest shortest path of 4.

8-5
Figure 7: A graph with radius 2. f has the minimum eccentricity of 2.

2 Proofs
Theorem 2.1 A graph is connected if and only if for every partition of its vertices into
two non empty sets, there is an edge with end points in both sets.

Proof. [3] Let G be a connected graph. Given a partition of V (G) into non empty sets S, T .
Choose u  S and v  T . Since G is connected, G has a u, v -path P . After its last vertex
in S, P has an edge from S to T .

We show that if G is not connected then for some partition there is no edge across. In
particular, if G is disconnected, then let it be a component of G. Since H is a maximal
connected sub graph of G and the connection relation is transitive, there can not be an
edge with one end point in V (H) and the other end point outside. Thus for the partition of
V (G) into V (H) and V (G) − V (H) there is no edge with end points in both of these sets.
2

Theorem 2.2 An edge of a graph is cut edge if and only if it does not belong to any cycle.

Proof. [2] Let, e be an edge in a graph G with end points x and y, and let H be the com-
ponent containing e. Since definition of e affects no other component, it suffices to prove
that H − e is connected if and only if e belongs to a cycle. See Figure 8

First, suppose that H − e is connected. This implies that H − e is contains an x, y-path


and this path completes a cycle with e. Now, suppose that e lies in a cycle C. Choose
u, v  V (H). Since H is connected, H has a u, v-path P . If P does not contain e, then
P exist in H − e. If P contains e, suppose by symmetry that x is between u and y on P .
Since H − e contains a u, x-path along P , an x, y-path along C and a y, v-path along P ,
the transitivity of the connection relation implies that H − e has a u, v-path. We did this
for all u, v  V (H), so H − e is connected. 2

8-6
Figure 8: Theorem 2.2

Theorem 2.3 (König[1936]) A graph is bipartite if and only if it has no odd cycle.

Proof. [2] N ecessity. Let G be a bipartite graph. Every walk alternates between the two
sets of a bipartition, so every return to the original partite set happens after an even number
of steps. Hence G has no odd cycle. See Figure 9

Figure 9: Theorem 2.3

Sufficiency. Let G be a graph with no odd cycle. We prove that G is bipartite by


constructing a bipartition of each non trivial component. Let, u be a vertex in a nontrivial
component H. For each vV (H), let f (v) be the minimum length of a u, v-path. Since H
is connected, f(v) is defined for each vV (H).

Let, X = vV (H) : f (v) is even and X = vV (H) : f (v) is odd. An edge v, v 0 within
X or Y would create a closed odd walk using a shortest u, v-path, the edge vv 0 , and the
reverse of a shortest u, v-path. Such a walk must contain an odd cycle(because every closed
odd walk contains an odd cycle)which contradicts our hypothesis. Hence X and Y are
independent sets. Also X ∪ Y = V (H), so H is an X − Y - bigraph. 2

Theorem 2.4 If a graph has no odd cycle, then it is bipartite.

Proof. [1] Pick up a random vertex v in G, calculate the length of the shortest simple path
from v to any other node, call this value distance from v, and divide nodes into 2 groups

8-7
according to the parity of their distance to v. If we can prove that nodes belong to the
same group can not be adjacent, then we know that we actually get a partition of the G
that fulfill the definition of bipartite graph.

Now, to introduce contradiction, assume two nodes x, y with both even or odd distance
from v are adjacent, then the shortest simple path < v, x >, < v, y > and edge x, y contains
a cycle with odd length, which is contradictory to that G has no cycles of odd length. In
other words, nodes both with even or odd distance from v can not be adjacent, which is
exactly what we need.

Again to prove that < v, x > and < v, y > together with < x, y > contains a cycle with
odd length is obvious when < v, x > and < v, y > are disjoint. When that’s not the case,
let’s give the last node shared by < v, x > and < v, y > the name v. So the three nodes
v, x, y forms a cycle with length

L = len(< v, x >)+len(< v, y >)+1 = len(< v, x >)+len(< v, y >)−2len(< v, v >)+1.

where len() means the length of the shortest path.As len(< v, x >) and len(< v, y >)
are both even or odd, then L must be odd. Therefore, in both cases, disjoint or not, <
v, x >, < v, y > and < x, y > contains a cycle with odd length, which is again contradictory.
So that concludes our proof that G is bipartite. 2

Theorem 2.5 Suppose G has a vertex set (v1 , v2 ......vn ) with n ≥ 3, if it has at least two
of its sub graphs ( G − v1 , G − v2 , .....G − vn ) are connected then G is connected.

Proof. Let, us say that G is not connected i.e there exist at least one vertex u  G from
which there is no path to at least another vertex v  G. See Figure 10
Suppose we take two random vertices vi and vj for which we have two different connected
sub graphs (G − vi ) and (G − vj ). Now, in case of the sub graph (G − vi ), there exist a
path from the vertex vj to all other vertices because it is connected. Again, in case of the
sub graph (G − vj ), there exist a path from the vertex vi to all other vertices because it is
also connected.

So, if we take any other common vertices of these two sub graphs (say vk ), then we have
a path from vi to vk and from vk to vj . From that we can conclude that we can also have
a path from vi to vj . As we have chosen vi and vj randomly, so that is also true for all
the other vertices, i.e there exist a path between every pair of vertices. That concludes our
proof that the graph G is connected. 2

8-8
Figure 10: Theorem 2.5

References
[1] StackExchange. If a graph has no cycles of odd length, then it is bipartite:
is my proof correct? http://math.stackexchange.com/questions/61920/
if-a-graph-has-no-cycles-of-odd-length-then-it-is-bipartite-is-my-proof-correc,
[Online, accessed 28 August, 2014].

[2] Douglas B. West. Introduction To Graph Theory. Pearson Prentice Hall, 2 edition.

[3] Douglas B. West. Introduction To Graph Theory Solution Manual. Summer 2005 edition.

[4] Wikipedia. Depth-first Search. http://en.wikipedia.org/wiki/Depth-first_


search, [Online, accessed 28 August, 2014].

[5] Wikipedia. Graph Traversal. http://en.wikipedia.org/wiki/Graph_traversal,


[Online, accessed 28 August, 2014].

8-9

You might also like