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
be an undirected graph. Two vertices are connected if there exists a path from to .
This means that there is a sequence
such that
for every
The path may have length . Thus every vertex is connected to itself.
8.2 Connected Graphs
A graph is connected if every pair of vertices in is connected.
Equivalently, is connected if for all , there exists a path from to .
For example, the path graph
is connected. Its vertices can be arranged as
with edges
Any vertex can reach any other vertex by moving along the path.
The complete graph
is connected for every
Every pair of distinct vertices is joined by an edge, so every pair is joined by a path of length .
8.3 Disconnected Graphs
A graph is disconnected if it is not connected.
Thus a graph is disconnected if there exist vertices and such that no path joins to .
For example, let
and
There is a path from to , and there is a path from to . But there is no path from to . 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
and
the connected components have vertex sets
and
The first component contains the path
The second component contains the edge
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 .
It is symmetric because in an undirected graph, any path from to can be read backward as a path from to .
It is transitive because if there is a path from to , and a path from to , then joining the two paths gives a walk from to . Removing repeated vertices gives a path from to .
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 is often written as
A graph is connected exactly when
A graph with no edges and vertices has
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 .
8.7 Isolated Vertices
An isolated vertex is a vertex of degree .
Every isolated vertex forms a connected component by itself. If
then no edge is incident with , so no path of positive length can begin at . The only vertex reachable from is itself.
Thus an isolated vertex prevents a graph with more than one vertex from being connected.
For example, if
and
then is isolated. The graph has two components:
and
8.8 Connected Subgraphs
A subgraph of is connected if every pair of vertices in can be joined by a path using only vertices and edges of .
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
the subgraph on vertices
is connected. But it is not a connected component of the whole graph, because it can be enlarged by adding and the edge .
8.9 Spanning Connected Subgraphs
A subgraph is spanning if it contains every vertex of the original graph.
A graph 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 to , then there is a path from to . 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 to is
the length of a shortest path from to .
Since the graph is connected, such a path always exists.
Distances in a connected graph satisfy the usual metric properties:
and
The last inequality is the triangle inequality. It follows by joining a shortest path from to with a shortest path from to , then observing that the shortest path from to cannot be longer than that walk.
8.12 Diameter
The diameter of a connected graph is the largest distance between any two vertices:
The diameter measures how far apart the most distant vertices are.
For the path graph ,
For the complete graph , with ,
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 in a connected graph is
It is the greatest distance from to any other vertex.
The radius of is
A center of 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 is a bridge, then
In a connected graph, this means that 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 , 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 is a cut vertex, then removing 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
the vertices and are cut vertices. Removing either one disconnects the graph.
The endpoints and are not cut vertices.
8.16 Connectedness and Minimum Edges
A connected graph with vertices must have at least
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 vertices, at least such additions are required.
Equivalently, every connected graph contains a spanning tree, and every tree on vertices has edges.
Thus no graph with fewer than edges can be connected.
8.17 Connectedness and Maximum Components
If a graph has vertices and edges, then each edge can reduce the number of components by at most .
Starting from the empty graph on vertices, there are components. Adding one edge can join two components, reducing the count by , or it can lie inside an existing component, leaving the count unchanged.
Therefore
This bound is useful for quick impossibility arguments. If
then
so 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 , there is a directed path from to .
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
is weakly connected but not strongly connected. There is a directed path from to , but no directed path from to .
8.19 Testing Connectedness
In a finite graph, connectedness can be tested by graph traversal.
Choose a starting vertex . Run breadth-first search or depth-first search from . 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
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 . Repeating the process from unvisited vertices finds all connected components.
8.20 Example
Let
and
The vertices form one component. They are mutually connected, and they form a triangle.
The vertices form a second component. They form a path.
The vertex is isolated and forms a third component.
Thus
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.