Mathwords logoMathwords

Complement of a Graph — Definition, Formula & Example

The complement of a graph is the graph you get by keeping every vertex, erasing the existing edges, and drawing an edge between every pair of vertices that was not connected before. Two vertices are adjacent in the complement exactly when they are not adjacent in the original graph.

Let G=(V,E)G = (V, E) be a simple graph with nn vertices. Its complement G‾\overline{G} (also written GcG^c) is the simple graph with vertex set VV and edge set E‾={{u,v}:u,v∈V, u≠v, {u,v}∉E}\overline{E} = \{\{u, v\} : u, v \in V,\ u \neq v,\ \{u, v\} \notin E\}. Equivalently, EE and E‾\overline{E} are disjoint, and their union is the edge set of the complete graph KnK_n on VV.

Key Formula

∣E(G‾)∣=(n2)−∣E(G)∣=n(n−1)2−∣E(G)∣|E(\overline{G})| = \binom{n}{2} - |E(G)| = \frac{n(n-1)}{2} - |E(G)|
Where:
  • nn = Number of vertices, which is the same in GG and G‾\overline{G}
  • ∣E(G)∣|E(G)| = Number of edges in the original graph
  • ∣E(G‾)∣|E(\overline{G})| = Number of edges in the complement
  • (n2)\binom{n}{2} = Number of edges in the complete graph KnK_n, which is every possible pair of distinct vertices

Worked Example

Problem: Let GG be the 5-cycle with vertices 1,2,3,4,51, 2, 3, 4, 5 and edges 12,23,34,45,5112, 23, 34, 45, 51, where uvuv means the edge {u,v}\{u, v\}. Find G‾\overline{G} and describe its shape.
Step 1: Count every possible edge on 5 vertices. This is the edge count of K5K_5.
(52)=5⋅42=10\binom{5}{2} = \frac{5 \cdot 4}{2} = 10
Step 2: List all 10 pairs and remove the 5 edges of GG. The pairs that remain are the edges of the complement.
E‾={13, 14, 24, 25, 35},∣E‾∣=10−5=5\overline{E} = \{13,\ 14,\ 24,\ 25,\ 35\}, \quad |\overline{E}| = 10 - 5 = 5
Step 3: Check the degrees. Every vertex has degree 2 in GG, so each has degree 5−1−2=25 - 1 - 2 = 2 in G‾\overline{G}. Following the edges gives one closed loop through all five vertices.
1→3→5→2→4→11 \to 3 \to 5 \to 2 \to 4 \to 1
Answer: G‾\overline{G} has edges 13,14,24,25,3513, 14, 24, 25, 35. It forms the cycle 1-3-5-2-4-11\text{-}3\text{-}5\text{-}2\text{-}4\text{-}1, so it is another 5-cycle. A graph that is isomorphic to its own complement, like C5C_5, is called self-complementary.

Why It Matters

In a discrete math course, complements let you turn one problem into another. A set of vertices is a clique in GG exactly when it is an independent set in G‾\overline{G}, so a method for finding one also finds the other. Ramsey theory's classic result R(3,3)=6R(3,3) = 6 says that for any graph on 6 vertices, either the graph or its complement contains a triangle.

Common Mistakes

Mistake: Adding a loop at each vertex because no vertex is joined to itself in GG.
Correction: The complement uses only pairs of distinct vertices (u≠vu \neq v). It is defined for simple graphs, and the complement of a simple graph is also simple, with no loops and no repeated edges.

Related Terms

  • Complete Graph — Graph whose complement has no edges at all
  • Clique — Cliques in a graph become independent sets in its complement
  • Bipartite Graph — Complete bipartite graph's complement is two disjoint complete graphs
  • Pseudograph — Allows loops and multiple edges, so the standard complement does not apply
  • Independent Set — Independent sets in a graph are cliques in its complement