0% found this document useful (0 votes)
36 views6 pages

Connected Components

Uploaded by

abraham gk
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)
36 views6 pages

Connected Components

Uploaded by

abraham gk
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/ 6

Math 3322: Graph Theory1 Mikhail Lavrov

Lecture 2: Connected components


August 15, 2024 Kennesaw State University

1 Equivalence relations
Let G be a graph. We define a relation ∼ on two vertices v, w ∈ V (G): v ∼ w if there is a v − w
walk in G. Our first plan for today is to prove:
Proposition 1.1. The relation ∼ is an equivalence relation on V (G).
Before we do that, though, let’s talk about equivalence relations.
You may have already seen the definition in other classes (or not). A relation R is an equivalence
relation on a set S if it has three properties:
1. It is reflexive: for all x ∈ S, x R x.
2. It is symmetric: for all x, y ∈ S, if x R y, then y R x.
3. It is transitive: for all x, y, z ∈ S, if x R y and y R z, then x R z.
But these are not just nice properties we want to prove because we like how they sound! There is
a purpose to showing that something is an equivalence relation.
These three properties are exactly the things we need to check in order to know that we can split
up (or partition) S into equivalence classes: disjoint sets S1 , . . . Sk such that S = S1 ∪ · · · ∪ Sk
and we have x R y exactly when x and y are in the same class. In the case of our relation ∼, the
equivalence classes will give us the connected components of a graph.

Proof of Proposition 1.1. Let’s check all three properties of an equivalence relation.
We check that ∼ is reflexive: for any vertex v, there is a v − v walk in G. Well, one such walk
that’s guaranteed to exist is the walk of length 0 that’s just the sequence (v). (There may or may
not be others.)
We check that ∼ is symmetric: if there is a v − w walk in G, there is also a w − v walk. Well,
suppose that (v0 , v1 , v2 , . . . , vℓ ) is a v − w walk (with v0 = v and vℓ = w). Then reverse it:
(vℓ , vℓ−1 , vℓ−2 , . . . , v0 ) is a w − v walk. It starts at w, ends at v, and consecutive vertices in the
sequence are adjacent, because they were also consecutive in the v − w walk.
Finally, we check that ∼ is transitive. Suppose u, v, w are vertices in G such that there is a u − v
walk (x0 , x1 , . . . , xℓ ) and a v − w walk (y0 , y1 , . . . , ym ). We know u = x0 , v = xℓ = y0 , and w = ym .
Then there is also a u − w walk: the sequence

(x0 , x1 , . . . , xℓ , y1 , y2 , . . . , ym ).
1
This document comes from the Math 3322 course webpage: http://facultyweb.kennesaw.edu/mlavrov/
courses/3322-fall-2024.php

1
This definitely starts at u = x0 and ends at w = ym . All consecutive vertices are adjacent, because
they were already consecutive in the two walks we started with, with the exception of one pair we
need to look at more closely: xℓ and y1 . These are adjacent because xℓ = v = y0 , and y0 y1 is an
edge because (y0 , y1 , . . . , ym ) is a walk.
Having checked all three properties, we know that ∼ is an equivalence relation.

2 Connected components
There’s two ways to think of connected components of a graph: as sets of vertices, and as subgraphs.
We don’t know what subgraphs are yet, so let’s table that one for now; define a connected
component of G to be a set C ⊆ V (G) such that
• Whenever v, w ∈ C, there is a v − w walk in G;
• If v ∈ C but w ∈
/ C, there is no v − w walk in G.
The relation ∼ is an equivalence relation on V (G), so we can partition V (G) into equivalence
classes: V (G) = C1 ∪ C2 ∪ · · · ∪ Ck . Look at what it means to be an equivalence class of ∼, and at
what it means to be a connected component. We conclude:
Theorem 2.1. The vertices of any graph can be partitioned into connected components.
In particular, if there is only one connected component—if there is a walk from any vertex to any
other vertex—then we say the graph is connected.
Why is this interesting? There are two reasons:
• When we asked the question “which vertices v, w have a walk between them?” the answer
could have been, in principle, a disorganized n × n table of yeses and nos.
Now we know that the answer can be given much more concisely: listing the connected
components is enough to know the answer for any two vertices.
• Connected components of a graph basically don’t interact with each other. A lot of the
time, if we’re asking a question about graphs, we can work with each connected component
separately.
For example, if we’re looking for a circuit board layout, and our circuit has multiple connected
components, then we can just find a layout of each component separately. Then, put those
components in different places on the circuit board.
Or suppose we’re looking for the largest independent set: a set of vertices with no edges
between them. (This came up in the tiling problem from the previous lecture.) We can just
find the largest independent set inside each component, then take their union.

3 Paths, distances, and cycles


In the previous lecture, we already saw the definition of a v − w path: it is a v − w walk with no
repeated vertices. When is there a path from one vertex to another? The answer is simple:

2
Theorem 3.1. Let v, w be two vertices of a graph G. If there is a v − w walk in G, then there is
a v − w path in G, as well. Moreover, the shortest v − w walk is always a path.
We will return to this theorem (how to prove it, and how to use it) in the next lecture.
Recall that the length of a walk (v0 , v1 , . . . , vℓ ) is ℓ. The distance between vertices v and w
(sometimes written d(v, w)) is the length of the shortest v − w walk, which we now know is also the
length of the shortest v − w path. If v and w are in different connected components, then there is
no such walk, and we sometimes say that d(v, w) = ∞ in that case.
For example, consider the following graph, in which every vertex has been labeled with its distance
from u:
s t 1 2

u v w x 0 1 3 3

y z 1 2

If you wanted to find all these distances, you could imagine the following procedure. Start by
“exploring” all the edges out of u, and labeling their other endpoints with a 1. Then, explore
all the edges out of those vertices: if they go somewhere new we haven’t been before, label those
vertices with a 2. Then, explore from the vertices labeled 2, and so on, until the entire graph has
been visited.
The diameter of a graph is the longest distance between any two vertices. In the above graph,
the diameter is 3, though that’s not apparent just from the picture, which only includes distances
involving u.
Graphs don’t just have diameters, they also have circumferences! (This terminology is a bit silly.)
To do this, we first have to figure out here the circle is.
A closed walk in a graph is a walk that begins and ends at the same vertex. These can be very
boring: for example, (u) by itself is a closed walk, and so is the walk (s, t, s, t, s, t, s, t, s, t, s). So
we generally want to add something else to make the definition interesting.
A cycle is a closed walk of length at least 3 with no repeated vertices, except at the start and end.
(“Length at least 3” excludes examples like (u) and (s, t, s), ensuring that all the edges involved
are different.) In the graph above, (s, u, v, s) is a cycle.
The circumference of a graph—which we won’t study in detail until much later—is the length of
the longest cycle in a graph. The graph above has circumference 8; can you see why?

4 Subgraphs
A subgraph H of a graph G is simply a graph such that:
• Its vertices V (H) are a subset of V (G). (Possibly all of them, and possibly just some.)
• Its edges E(H) are a subset of E(G). (Possibly all of them, and possibly just some—but keep
in mind that we can’t include an edge of G unless we’ve included both of its vertices.)

3
Here are a few example subgraphs of the graph from the previous section:
s t s s t

u v u v u v w x

y z y y z

We don’t have to include all the vertices. If we include both endpoints of an edge of G, we don’t
have to include that edge.
However, if the vertices of H are a subset S ⊆ V (G), and the edges of H are all the edges of G
between vertices in S, then H is called an induced subgraph, or the subgraph of G induced
by S. This is sometimes written G[S]. Essentially, the induced subgraph is the “most natural”
subgraph to take with the vertices on S. Among the examples above, the middle one is the only
induced subgraph: it could be written as G[{s, u, v, y}].
When we defined connected components, we partitioned the vertices V (G) as C1 ∪ C2 ∪ · · · ∪ Ck .
Sometimes, we also define the connected components as the induced subgraphs

G[C1 ], G[C2 ], . . . , G[Ck ].

These are connected subgraphs of G that are “as large as possible”: you can’t make larger connected
subgraphs by including more vertices.
Two important ways to define a subgraph of G are by deleting vertices or edges. We write “G − v”
for the subgraph of G with v (and all edges out of v) removed. We write “G − vw” for the subgraph
of G with edge vw (and nothing else) removed.

5 Drawing graphs on computers (optional)


There’s lots of tools out there that will draw graphs for you. If you use a computer algebra system
like Mathematica, Maple, or MATLAB, you might already know how to use it to draw graphs.
If you don’t use any of those, I recommend Graphviz, which has the following advantages:
• It is not too hard to use to do the basic things: I can get you started today.
• You can do fancier things if you look things up in the documentation (or ask me).
• You can use it through your browser, at http://www.webgraphviz.com/.
For the basics, here is code that you can paste into the online interface and generate the graph of
the three cups puzle from the previous lecture:
graph {
UUU -- UDD; UUU -- DDU; UDD -- DUD; DDU -- DUD;
DDD -- DUU; DDD -- UUD; DUU -- UDU; UUD -- UDU;
}
Just use vertex1 -- vertex2; to draw an edge between two vertices. You can also write vertex;
all by itself if you want to add an isolated vertex with no edges out of it.

4
6 Practice problems
1. We will be introduced to the cube graph soon; a diagram of it is shown below.

(a) Pick a vertex of the cube, and call it v. Label all other vertices with their distance to v.
(b) In this case, the largest distance you found is also the diameter of the cube graph (no
matter which vertex you picked to be v). Why is not true for all graphs?
Can you describe what property the cube graph has that guarantees you’ll always find
the diameter this way, no matter which vertex you picked to be v?
2. Here is another 8-vertex graph:

In general, an 8-vertex graph can have cycles of any length between 3 and 8. In this graph,
you can find cycles of all these lengths, except for one.
Find one of each possible length! Which length is missing?
3. Let G be the graph shown below:

(a) How many induced subgraphs with at least one vertex does G have?
(b) A spanning subgraph is one that includes all the vertices of a graph, but maybe not
all the edges. How many spanning subgraphs does G have?
(c) How many subgraphs of any kind (but with at least one vertex) does G have? This one
is trickier; you will need to think about the structure of G.
4. Prove that the distance between vertices in a connected graph satisfies the following proper-
ties, for all vertices x, y, and sometimes z:
(a) d(x, y) = 0 if and only if x = y.
(b) d(x, y) = d(y, x).
(c) d(x, z) ≤ d(x, y) + d(y, z).
Some of these properties are easier than others, but I am listing them for two reasons. First
of all, in some way, they correspond to the proof of Proposition 1.1. Second, they are the

5
three properties that make a connected graph a metric space with metric d; this is something
you might learn about in other classes.
5. If a graph has 6 vertices, what are the possible values its diameter can have? For each of
those values, give an example.
6. To really understand the proof of Proposition 1.1, it helps to try to generalize it and see what
works and what doesn’t.
Take the following two relations on the vertices of a graph G:
• v ⌢ w if there is a v − w walk of odd length.
• v ⌣ w if there is a v − w walk of even length.
For one of these, we can copy the proof of Proposition 1.1 almost word-for-word and prove
that it is also an equivalence relation.
For the other one, this will not work: there are two places where the proof will fail. Find
those places!
7. Let G be a graph, and let S, T ⊆ V (G) be two sets of vertices. Assume that S ∩T is nonempty:
the two sets have at least one vertex in common.
Prove that if the induced subgraphs G[S] and G[T ] are connected, so is G[S ∪ T ].
8. Take the graph on vertices s, t, u, v, w, x, y, z from today’s lecture, and draw a diagram of it
using a computer.
(To be clear: this is not a necessary skill for this class. It’s just something that might make
your life easier.)

You might also like