Skip to content

Chapter 8. Connected Graphs

A graph is connected when its vertices belong to one piece. More precisely, an undirected graph is connected if every pair of vertices can be joined by a path. If this condition fails, the graph is disconnected and separates into connected components. Standard texts define connectedness through paths and treat connected components as maximal connected subgraphs.

Connectedness is a global property. Degree describes the immediate neighborhood of one vertex. Connectedness describes whether the whole graph can be traversed from any starting vertex.

8.1 Connected Vertices

Let

G=(V,E) G = (V,E)

be an undirected graph. Two vertices u,vVu,v \in V are connected if there exists a path from uu to vv.

This means that there is a sequence

u=v0,v1,,vk=v u = v_0, v_1, \ldots, v_k = v

such that

{vi1,vi}E \{v_{i-1},v_i\} \in E

for every

1ik. 1 \leq i \leq k.

The path may have length 00. Thus every vertex is connected to itself.

8.2 Connected Graphs

A graph GG is connected if every pair of vertices in GG is connected.

Equivalently, GG is connected if for all u,vV(G)u,v \in V(G), there exists a path from uu to vv.

For example, the path graph

P5 P_5

is connected. Its vertices can be arranged as

v1,v2,v3,v4,v5, v_1,v_2,v_3,v_4,v_5,

with edges

{v1,v2},{v2,v3},{v3,v4},{v4,v5}. \{v_1,v_2\}, \{v_2,v_3\}, \{v_3,v_4\}, \{v_4,v_5\}.

Any vertex can reach any other vertex by moving along the path.

The complete graph

Kn K_n

is connected for every

n1. n \geq 1.

Every pair of distinct vertices is joined by an edge, so every pair is joined by a path of length 11.

8.3 Disconnected Graphs

A graph is disconnected if it is not connected.

Thus a graph is disconnected if there exist vertices uu and vv such that no path joins uu to vv.

For example, let

V={a,b,c,d,e} V=\{a,b,c,d,e\}

and

E={{a,b},{b,c},{d,e}}. E=\{\{a,b\}, \{b,c\}, \{d,e\}\}.

There is a path from aa to cc, and there is a path from dd to ee. But there is no path from aa to dd. Therefore the graph is disconnected.

Disconnected graphs consist of separate connected pieces.

8.4 Connected Components

A connected component of a graph is a maximal connected subgraph.

Maximal means that no more vertices or edges from the original graph can be added while preserving connectedness.

In the graph

V={a,b,c,d,e} V=\{a,b,c,d,e\}

and

E={{a,b},{b,c},{d,e}}, E=\{\{a,b\}, \{b,c\}, \{d,e\}\},

the connected components have vertex sets

{a,b,c} \{a,b,c\}

and

{d,e}. \{d,e\}.

The first component contains the path

a,b,c. a,b,c.

The second component contains the edge

{d,e}. \{d,e\}.

There is no edge or path connecting the two components.

8.5 Components as Equivalence Classes

Connectedness among vertices is an equivalence relation.

It is reflexive because every vertex is connected to itself by a path of length 00.

It is symmetric because in an undirected graph, any path from uu to vv can be read backward as a path from vv to uu.

It is transitive because if there is a path from uu to vv, and a path from vv to ww, then joining the two paths gives a walk from uu to ww. Removing repeated vertices gives a path from uu to ww.

Therefore connectedness partitions the vertex set into equivalence classes. These equivalence classes are exactly the connected components. Each vertex belongs to exactly one connected component.

8.6 Number of Components

The number of connected components of GG is often written as

c(G). c(G).

A graph is connected exactly when

c(G)=1. c(G)=1.

A graph with no edges and nn vertices has

c(G)=n, c(G)=n,

because every vertex forms its own component.

A null graph, if allowed, has no vertices. Depending on convention, its number of components may be taken as 00.

8.7 Isolated Vertices

An isolated vertex is a vertex of degree 00.

Every isolated vertex forms a connected component by itself. If

deg(v)=0, \deg(v)=0,

then no edge is incident with vv, so no path of positive length can begin at vv. The only vertex reachable from vv is vv itself.

Thus an isolated vertex prevents a graph with more than one vertex from being connected.

For example, if

V={a,b,c} V=\{a,b,c\}

and

E={{a,b}}, E=\{\{a,b\}\},

then cc is isolated. The graph has two components:

{a,b} \{a,b\}

and

{c}. \{c\}.

8.8 Connected Subgraphs

A subgraph HH of GG is connected if every pair of vertices in HH can be joined by a path using only vertices and edges of HH.

A connected component is a connected subgraph that is maximal with respect to inclusion.

The word maximal is important. A connected subgraph may be contained in a larger connected subgraph.

For example, in the path

a,b,c,d, a,b,c,d,

the subgraph on vertices

{a,b,c} \{a,b,c\}

is connected. But it is not a connected component of the whole graph, because it can be enlarged by adding dd and the edge {c,d}\{c,d\}.

8.9 Spanning Connected Subgraphs

A subgraph is spanning if it contains every vertex of the original graph.

A graph GG is connected exactly when it has a connected spanning subgraph.

For example, every connected graph has a spanning tree. A spanning tree contains all vertices and enough edges to connect them without forming cycles.

This fact links connectedness with trees. Later chapters will show that a graph is connected if and only if it has a spanning tree.

8.10 Paths and Connectedness

Connectedness is defined by paths, but walks give an equivalent condition.

If there is a walk from uu to vv, then there is a path from uu to vv. Repeated vertices can be removed from the walk until no vertex repeats.

Therefore a graph is connected if every pair of vertices is joined by a walk.

This version is often useful in proofs. One may naturally construct a walk first, then reduce it to a path.

8.11 Distance in Connected Graphs

In a connected graph, the distance between any two vertices is finite.

The distance from uu to vv is

d(u,v), d(u,v),

the length of a shortest path from uu to vv.

Since the graph is connected, such a path always exists.

Distances in a connected graph satisfy the usual metric properties:

d(u,v)0, d(u,v) \geq 0, d(u,v)=0    u=v, d(u,v)=0 \iff u=v, d(u,v)=d(v,u), d(u,v)=d(v,u),

and

d(u,w)d(u,v)+d(v,w). d(u,w) \leq d(u,v)+d(v,w).

The last inequality is the triangle inequality. It follows by joining a shortest path from uu to vv with a shortest path from vv to ww, then observing that the shortest path from uu to ww cannot be longer than that walk.

8.12 Diameter

The diameter of a connected graph is the largest distance between any two vertices:

diam(G)=maxu,vV(G)d(u,v). \operatorname{diam}(G) = \max_{u,v \in V(G)} d(u,v).

The diameter measures how far apart the most distant vertices are.

For the path graph PnP_n,

diam(Pn)=n1. \operatorname{diam}(P_n)=n-1.

For the complete graph KnK_n, with n2n \geq 2,

diam(Kn)=1. \operatorname{diam}(K_n)=1.

A small diameter means that every vertex is close to every other vertex. This is common in many communication and social network models.

8.13 Radius and Center

The eccentricity of a vertex vv in a connected graph is

ecc(v)=maxuV(G)d(v,u). \operatorname{ecc}(v) = \max_{u \in V(G)} d(v,u).

It is the greatest distance from vv to any other vertex.

The radius of GG is

rad(G)=minvV(G)ecc(v). \operatorname{rad}(G) = \min_{v \in V(G)} \operatorname{ecc}(v).

A center of GG is a vertex whose eccentricity equals the radius.

The center consists of vertices that are as close as possible to the whole graph.

In a path graph, the center is the middle vertex if the path has odd order, and the two middle vertices if the path has even order.

8.14 Bridges and Connectedness

An edge whose removal increases the number of connected components is called a bridge or cut edge.

If ee is a bridge, then

c(Ge)>c(G). c(G-e) > c(G).

In a connected graph, this means that GeG-e is disconnected.

Bridges are edges that carry essential connectivity. They do not lie on cycles. If an edge lies on a cycle, then removing it still leaves an alternate route around the rest of the cycle.

For example, in a tree, every edge is a bridge. In a cycle graph CnC_n, no edge is a bridge.

8.15 Cut Vertices

A cut vertex, or articulation point, is a vertex whose removal increases the number of connected components.

If vv is a cut vertex, then removing vv and all edges incident with it separates the graph into more pieces.

Cut vertices are important in network reliability. They identify single points whose failure can disconnect a system.

In the path graph

v1,v2,v3,v4, v_1,v_2,v_3,v_4,

the vertices v2v_2 and v3v_3 are cut vertices. Removing either one disconnects the graph.

The endpoints v1v_1 and v4v_4 are not cut vertices.

8.16 Connectedness and Minimum Edges

A connected graph with nn vertices must have at least

n1 n-1

edges.

This lower bound is attained by trees.

Proof

Start with one vertex. Each time an edge is used to bring in a new vertex, at most one new vertex can be added to the connected part. To connect all nn vertices, at least n1n-1 such additions are required.

Equivalently, every connected graph contains a spanning tree, and every tree on nn vertices has n1n-1 edges.

Thus no graph with fewer than n1n-1 edges can be connected.

8.17 Connectedness and Maximum Components

If a graph has nn vertices and mm edges, then each edge can reduce the number of components by at most 11.

Starting from the empty graph on nn vertices, there are nn components. Adding one edge can join two components, reducing the count by 11, or it can lie inside an existing component, leaving the count unchanged.

Therefore

c(G)nm. c(G) \geq n-m.

This bound is useful for quick impossibility arguments. If

m<n1, m < n-1,

then

c(G)nm>1, c(G) \geq n-m > 1,

so GG is disconnected.

8.18 Connectedness in Directed Graphs

Directed graphs require more than one notion of connectedness.

A directed graph is strongly connected if for every ordered pair of vertices u,vu,v, there is a directed path from uu to vv.

It is weakly connected if the underlying undirected graph is connected after ignoring edge directions.

Strong connectedness requires two-way reachability. Weak connectedness only requires connection after directions are forgotten. These two notions are standard for directed graphs.

For example, the directed path

abc a \to b \to c

is weakly connected but not strongly connected. There is a directed path from aa to cc, but no directed path from cc to aa.

8.19 Testing Connectedness

In a finite graph, connectedness can be tested by graph traversal.

Choose a starting vertex ss. Run breadth-first search or depth-first search from ss. If every vertex is reached, the graph is connected. If some vertex is not reached, the graph is disconnected.

For a graph stored by adjacency lists, this takes time

O(V+E). O(|V|+|E|).

The traversal visits each vertex at most once and examines each edge a bounded number of times.

The same traversal also finds the connected component containing ss. Repeating the process from unvisited vertices finds all connected components.

8.20 Example

Let

V={a,b,c,d,e,f,g} V=\{a,b,c,d,e,f,g\}

and

E={{a,b},{b,c},{c,a},{d,e},{e,f}}. E= \{\{a,b\},\{b,c\},\{c,a\},\{d,e\},\{e,f\}\}.

The vertices a,b,ca,b,c form one component. They are mutually connected, and they form a triangle.

The vertices d,e,fd,e,f form a second component. They form a path.

The vertex gg is isolated and forms a third component.

Thus

c(G)=3. c(G)=3.

The graph is disconnected because more than one component exists.

8.21 Summary

A graph is connected if every pair of vertices is joined by a path. Connectedness is an equivalence relation on vertices, and its equivalence classes are the connected components. A graph is connected exactly when it has one component.

Connected graphs have finite distances between all vertex pairs. This leads to diameter, radius, eccentricity, and center. Edges or vertices whose removal destroys connectedness are bridges and cut vertices.

Connectedness is one of the basic global properties of a graph. It separates graphs that form one coherent structure from graphs that split into independent pieces.