Connectedness

3 min read Last updated Sun May 31 2026 19:40:41 GMT+0000 (Coordinated Universal Time)

Connected Graph

An undirected graph is connected iff every pair of vertices is connected by a path. Otherwise the graph is disconnected.

For directed graph, all directionality is dropped and connectivity is checked.

A graph is disconnected iff its vertex set can be split into 2 disjoint non-empty sets with no edges between them.

A graph is connected iff every entry of A+A2++An1A + A^2 + \dots + A^{n-1} is non-zero.

In a connected graph with n2n \ge 2 vertices, any two vertices are connected by a path of length kk where kn1k \le n - 1.

Connected Component

A maximal connected subgraph. Every pair of vertices inside are connected. No connection to outside vertices. Each component is an isolated piece of a graph.

A connected graph has exactly 1 connected component which is itself. A disconnected graph has more than 2 components.

Distance

Length of the shortest path between two vertices. Denoted as dist(u,v)\text{dist}(u, v). if no path exists, dist(u,v)=dist(u, v) = \infty. If a path exists between u,vu,v, then dist(u,v)n1\text{dist}(u,v) \le n - 1.

Properties:

  • Non-negativity: dist(u,v)0\text{dist}(u, v) \ge 0
  • Identity: dist(u,v)=0u=v\text{dist}(u, v) = 0 ⇔ u = v
  • Symmetry: dist(u,v)=dist(v,u)\text{dist}(u, v) = \text{dist}(v, u)
  • Triangle inequality: dist(u,w)dist(u,v)+dist(v,w)\text{dist}(u, w) \le \text{dist}(u, v) + \text{dist}(v, w)

For KnK_n, dist(u,v)=1\text{dist}(u,v)=1 for any u,vu,v pair.

Diameter

Maximum distance between any two vertices. Denoted as diam(G)\text{diam}(G).

diam(G)=max{dist(u,v)u,vV(G)}\text{diam}(G) = \text{max} \set{\text{dist}(u, v) | \forall u, v \in V(G)}

Measures the largest shortest path in the graph.

For KnK_n, diam(u,v)=1\text{diam}(u,v)=1.

Was this helpful?