Introduction
Numbers have arithmetic: add two numbers, multiply them, subtract one from another — and you get a new number. Graphs have their own arithmetic too. Given one or two graphs, graph theorists have defined precise operations that produce entirely new graphs with predictable, useful properties.
These operations are not just mathematical curiosities. The complement underlies Ramsey theory and independent sets. The join constructs wheel graphs. The line graph transforms edge problems into vertex problems. The Cartesian product builds the hypercube — a structure at the heart of parallel computing, coding theory, and network design.
In this post we cover the five most important graph operations, with visual examples for each.
1. The Complement
Definition
Definition: The complement of a graph , written (or ), is the graph on the same vertex set where two vertices are adjacent in if and only if they are not adjacent in .
The rule is simple:
- Every edge of → delete it from
- Every non-edge of → add it to
Example
Consider with 5 vertices and 5 edges:
Now swap every edge for a non-edge and vice versa:
The original edges (orange) disappear; the former non-edges (teal) become the new edges of .
The Fundamental Property
Theorem: (the complete graph on vertices).
Placing on top of always yields , because every pair of vertices is either an edge in or an edge in — never both, never neither. There is no overlap and no gap.
Consequences:
- — the edge counts are complementary
- — the complement of the complement is the original graph
- If , the graph is called self-complementary (e.g. , )
Connection to Independent Sets
A clique in (every pair connected) corresponds to an independent set in (no pair connected), and vice versa. This symmetry is the foundation of Ramsey theory:
2. The Union
Definition
Definition: The union of graphs and , written , is the graph whose vertex set is and whose edge set is .
When and are vertex-disjoint (share no vertices), the union is simply both graphs placed side-by-side on the same page with no connections between them. The result is always a disconnected graph with (at least) two components.
Example
Let (a triangle) and (a 4-cycle square). Their union:
The orange triangle () and the teal square () coexist on the same graph but share no vertices or edges — two completely separate components.
Notation for Multiple Copies
The disjoint union of copies of is written :
This notation appears frequently in graph theory: “ contains as a subgraph” means has two disjoint edges with no shared endpoints — a matching of size 2.
3. The Join
Definition
Definition: The join of graphs and , written , starts as their union but then adds a new edge from every vertex of to every vertex of .
If and , the join adds exactly new edges on top of the union.
Example: Building the Wheel Graph
The wheel graph is the classic application of the join.
Take (a single hub vertex) and (a 5-cycle ring). Their join connects the hub to every ring vertex:
The orange hub (from ) gains edges to all 5 teal ring vertices (from ), producing the spokes. The ring edges remain. The result is — a wheel with 5 spokes.
General formula for :
- Vertices:
- Edges: (ring) (spokes)
Other Join Examples
| Operation | Result |
|---|---|
| (a single edge) | |
| (complete bipartite graph) | |
| (wheel graph) | |
| (complete graph on 5 vertices) |
The second row is important: joining two independent sets (no edges) produces the complete bipartite graph — every vertex on one side connects to every vertex on the other side.
4. The Line Graph
Definition
Definition: The line graph of a graph is constructed as follows:
- For every edge , create a new vertex in
- Two vertices and in are adjacent if and only if the corresponding edges and share an endpoint in
The line graph transforms an edge-focused problem into a vertex-focused one. Questions about edges in become questions about vertices in .
Intuition
Imagine placing a new dot at the midpoint of every road (edge). Two midpoint-dots are connected in the line graph if their roads share a junction (vertex). The midpoint network is .
Example
Let be a graph with 4 vertices and 5 edges :
Each edge becomes a vertex in . Two new vertices connect if their edges shared an endpoint in :
| Edge pair | Shared endpoint? | Edge in ? |
|---|---|---|
| — | Yes () | ✓ |
| — | Yes () | ✓ |
| — | Yes () | ✓ |
| — | No | ✗ |
| — | Yes () | ✓ |
| — | Yes () | ✓ |
| — | Yes () | ✓ |
| — | Yes () | ✓ |
| — | Yes () | ✓ |
| — | No | ✗ |
The 5 edges of became 5 colored vertices of , connected by 8 edges. The only two non-edges are – (disjoint vertex sets vs ) and – (disjoint vs ).
Key Properties of Line Graphs
- If is Eulerian (every vertex has even degree), then is Hamiltonian
- Whitney’s theorem: If , then implies (line graphs are almost uniquely invertible)
Why Line Graphs Matter
| Original problem on | Equivalent problem on |
|---|---|
| Edge coloring of | Vertex coloring of |
| Matching in | Independent set in |
| Eulerian trail in | Hamiltonian path in |
The line graph is a bridge between two different languages for describing the same structure.
5. The Cartesian Product
Definition
Definition: The Cartesian product of graphs and , written , is the graph where:
- Vertices: All ordered pairs where and
- Edges: Two vertices and are adjacent if and only if either:
- and , or
- and
In plain English: two pairs are adjacent when they differ in exactly one coordinate, and that difference is an edge in the corresponding graph.
Size facts:
-
-
Example A: Grid Graph
Let (path on 4 vertices: ) and (path on 3 vertices: ).
The product has vertices — each pair:
Reading the grid: The 4 columns are the 4 copies of (one per vertex of ). The 3 rows are the 3 copies of (one per vertex of ). Horizontal edges come from ’s edges; vertical edges come from ’s edges.
Verify the edge count: edges. Count them in the grid: 3 rows of 3 horizontal edges = 9, plus 4 columns of 2 vertical edges = 8. ✓
Example B: Hypercubes
The most celebrated application of the Cartesian product is the family of hypercubes. Start with — a single edge between vertices — and keep multiplying:
: Two vertices, one edge. (A line segment in 1D.)
: Four vertices , four edges. Two vertices are adjacent iff their binary labels differ in exactly one bit.
: Eight vertices (3-bit binary strings), twelve edges. This is the familiar 3D cube — adjacent vertices differ in exactly one bit.
The pattern: has vertices (all -bit binary strings) and edges. Two vertices are adjacent if and only if their binary labels differ in exactly one position (Hamming distance 1).
| Vertices | Edges | Real-world shape | |
|---|---|---|---|
| 2 | 1 | Line segment | |
| 4 | 4 | Square | |
| 8 | 12 | 3D Cube | |
| 16 | 32 | Tesseract (4D cube) | |
| -dimensional hypercube |
Commutativity and Associativity
Note: (the product is commutative up to isomorphism).
The Cartesian product is also associative: .
This is why we can write without specifying parenthesisation.
Comparing the Five Operations
| Operation | Symbol | Vertices | Edges | Key idea |
|---|---|---|---|---|
| Complement | Same as | All non-edges of | Flip edges and non-edges | |
| Union | Side-by-side, no new edges | |||
| Join | All of union + $ | V(G) | ||
| Line graph | $ | E(G) | $ | |
| Cartesian product | $ | V(G) | \cdot |
Practice Problems
Problem 1: Computing a Complement
Question: Graph has vertices and edges . List the edges of .
Click to reveal solution
$K_4$ has $\binom{4}{2} = 6$ edges: $\{12,13,14,23,24,34\}$.
Remove the edges of $G$: $12, 13, 24$.
$E(\overline{G}) = \{14, 23, 34\}$.
Verify: $|E(G)| + |E(\overline{G})| = 3 + 3 = 6 = \binom{4}{2}$ ✓
Problem 2: Self-Complementary Graph
Question: Show that (the path ) is self-complementary — i.e. .
Click to reveal solution
$P_4$ has edges $\{12,23,34\}$. The complement has $6 - 3 = 3$ edges: $\{13,14,24\}$.
Draw $\overline{P_4}$: vertex 1 connects to 3 and 4; vertex 2 connects to 4; vertex 3 connects to nothing except 1.
Try the mapping $\phi$: $1 \to 1$, $2 \to 3$, $3 \to 1$... Let's try $\phi: 1\mapsto 2, 2\mapsto 4, 3\mapsto 1, 4\mapsto 3$.
Check: edge $12 \to \phi(1)\phi(2) = 24$ ✓ (in $\overline{P_4}$), edge $23 \to \phi(2)\phi(3) = 41 = 14$ ✓, edge $34 \to \phi(3)\phi(4) = 13$ ✓.
$P_4 \cong \overline{P_4}$, so $P_4$ is self-complementary.
Problem 3: Line Graph
Question: Compute where (triangle with vertices and edges ).
Click to reveal solution
$L(G)$ has one vertex per edge of $G$: vertices $\{v_{AB}, v_{BC}, v_{CA}\}$.
Check every pair:
- $v_{AB}$ and $v_{BC}$: share endpoint $B$ → adjacent ✓
- $v_{BC}$ and $v_{CA}$: share endpoint $C$ → adjacent ✓
- $v_{AB}$ and $v_{CA}$: share endpoint $A$ → adjacent ✓
All 3 pairs are adjacent, so $L(G) = K_3$.
$L(K_3) \cong K_3$. The triangle is self-dual under the line graph operation — a beautiful symmetry!
Problem 4: Cartesian Product Edge Count
Question: Compute using the formula. What well-known graph is the result?
Click to reveal solution
$C_3$: 3 vertices, 3 edges. $K_2$: 2 vertices, 1 edge.
$|V| = 3 \times 2 = 6$ vertices.
$|E| = |E(C_3)| \cdot |V(K_2)| + |V(C_3)| \cdot |E(K_2)| = 3 \times 2 + 3 \times 1 = 6 + 3 = 9$ edges.
$C_3 \,\square\, K_2$ is a 6-vertex, 9-edge graph — this is the triangular prism (also called $Y_3$ or $K_3 \,\square\, K_2$). It is the 3D prism with two triangular faces and three square faces.
Problem 5: Join and Complete Bipartite
Question: Prove that .
Click to reveal solution
$\overline{K_m}$ is the empty graph on $m$ vertices (no edges). $\overline{K_n}$ is the empty graph on $n$ vertices.
Their union $\overline{K_m} \cup \overline{K_n}$ has $m + n$ vertices and 0 edges — still empty.
The join adds one edge from every vertex of $\overline{K_m}$ to every vertex of $\overline{K_n}$: exactly $m \times n$ new edges, and nothing else (neither $\overline{K_m}$ nor $\overline{K_n}$ had internal edges to begin with).
The result is a graph with $m + n$ vertices split into two groups of size $m$ and $n$, with every cross-pair connected and no internal edges — precisely $K_{m,n}$.
Problem 6: Hypercube Properties
Question: (a) How many vertices and edges does have? (b) What is the degree of every vertex in ?
Click to reveal solution
(a) $|V(Q_5)| = 2^5 = 32$. $|E(Q_5)| = 5 \cdot 2^{5-1} = 5 \cdot 16 = 80$.
(b) In $Q_n$, each vertex is an $n$-bit binary string. Its neighbours differ in exactly one bit position. There are $n$ bit positions, so each vertex has degree $n$.
$Q_n$ is an $n$-regular graph — every vertex has degree exactly $n$.
Sanity check with handshaking: $2|E| = n \cdot 2^n$, so $|E| = n \cdot 2^{n-1}$ ✓
Applications
Chip Design and Parallel Computing (Hypercubes)
Hypercube networks were the dominant parallel computer architecture in the 1980s–90s (nCUBE, Intel iPSC). With processors as vertices, any two processors that differ in one bit can communicate directly. The diameter of is (at most hops between any pair), and its high symmetry enables efficient routing algorithms. Today, hypercube topologies survive in GPU interconnect and distributed memory systems.
Coding Theory (Hypercubes and Hamming Distance)
The vertices of are all -bit binary codewords. Two codewords are adjacent in iff their Hamming distance is 1. A binary error-correcting code of minimum distance corresponds to an independent set in (the -th power of ). The design of efficient codes is directly tied to the combinatorics of hypercube subgraphs.
Social Network Analysis (Complement)
The complement of a social network is the “non-relationship” graph — useful for studying what connections are absent. Complement analysis reveals structural holes (people who could bridge communities but don’t), which is a key metric in social capital theory. Finding large cliques in (friend groups) is equivalent to finding large independent sets in .
Scheduling and Edge Colouring (Line Graphs)
A classic scheduling problem: given a set of tasks, each requiring a shared machine for one time slot, assign time slots to tasks so no machine is double-booked. This is exactly edge colouring of the conflict graph — which equals vertex colouring of . Vizing’s theorem (that ) was originally proved by analysing line graphs.
Transport Networks (Cartesian Product)
Grid street networks, printed circuit board routing layers, and multi-dimensional mesh networks are all Cartesian products in disguise. A city grid is . A 3D mesh supercomputer topology is . The Cartesian product’s diameter is — making it easy to compute routing distances in these structured networks.
Key Takeaways
- The complement swaps edges and non-edges. . Cliques in are independent sets in .
- The union places two graphs side-by-side without any new edges. The result is always disconnected when and are vertex-disjoint.
- The join is the union plus every possible cross-edge. Joining a single vertex to a cycle produces the wheel graph; joining two independent sets produces the complete bipartite graph.
- The line graph turns edges into vertices: two new vertices are adjacent iff their original edges shared an endpoint. It translates edge-colouring problems into vertex-colouring problems.
- The Cartesian product builds a grid-like graph: vertices are pairs and adjacency requires differing in exactly one coordinate along an existing edge. is the grid; repeated products of give the hypercube .
- is -regular with vertices and edges. Its vertices are binary strings; adjacency = Hamming distance 1. It is the backbone of parallel computing and coding theory.
Explore Further
Use the GraphArena Playground to experiment:
- Build any 5-vertex graph and manually construct its complement. Overlay them — do you get ?
- Build and . Use the join mentally: how many edges does have? Draw it — is it ?
- Construct a small graph with 4 edges and draw its line graph step-by-step using the midpoint rule.
- Build (a grid). Count vertices and edges — verify the formula.
- Extend to : start with two copies of , connect matching endpoints — do you get a square? Then repeat to build .
Graph operations are the grammar of graph theory — they let you express complex structured graphs concisely and reveal deep relationships between seemingly different graphs.