On this page
Two graphs can look nothing alike on paper and still be the same graph. A graph is only a set of vertices and the pairs that are joined; the drawing is decoration.
What does it mean for two graphs to be isomorphic?
An isomorphism of graphs G and H is a bijection f between their vertex sets such that u and v are adjacent in G if and only if f(u) and f(v) are adjacent in H (Graph isomorphism, Wikipedia). In plain words: a one-to-one renaming of vertices that keeps every edge an edge and every non-edge a non-edge.
So you have two different jobs. To show two graphs are not isomorphic, you need one difference that no renaming can fix. To show they are, you must write down the renaming and check it.
Which invariants should you check first?
A graph invariant is a quantity that depends only on the structure of a graph, not on its labels or drawing, so isomorphic graphs always agree on it (Graph property, Wikipedia). Check them cheapest first and stop at the first mismatch:
Number of vertices.
Number of edges.
Degree sequence: write every vertex's degree and sort the list.
Connectivity: how many separate pieces does each graph have?
Cycles: does one graph have a triangle or a 4-cycle that the other lacks?
Bipartiteness: can the vertices be split into two sides with every edge crossing between them? A graph with an odd cycle cannot.
Wolfram MathWorld notes that there is almost certainly no simple-to-calculate invariant that tells every pair of non-isomorphic graphs apart (Isomorphic Graphs, MathWorld). Later you will meet stronger invariants, such as planarity and Euler's formula or the chromatic polynomial of a graph.
Can two graphs with the same degree sequence be different?
Yes. Take G, a single 6-cycle: vertices 1 to 6 joined in a ring by the edges 1-2, 2-3, 3-4, 4-5, 5-6 and 6-1. Take H, two separate triangles: a-b-c and d-e-f.
Vertices: 6 and 6. Match.
Edges: 6 and 6. Match.
Degree sequence: (2, 2, 2, 2, 2, 2) for both. Match.
Connectivity: G is one piece, H is two. Mismatch.
You can stop there: G and H are not isomorphic. The other checks agree. H contains triangles and G does not. G is bipartite (odd-numbered vertices on one side, even on the other); H is not. Any one difference is a complete proof.
This is the common trap: matching the first three counts feels like strong evidence, but the degree sequence says how many edges touch each vertex, not where they go.
How do you build an explicit isomorphism?
When every invariant matches, use the invariants to narrow the choices. Let G have edges 1-2, 1-3, 1-4, 2-3, 4-5, and let H have edges s-t, p-q, r-s, q-r, p-r.
Degrees. In G, vertex 1 has degree 3, vertex 5 has degree 1, and 2, 3, 4 have degree 2. In H, r has degree 3, t has degree 1, and p, q, s have degree 2. Both sequences are (3, 2, 2, 2, 1).
Map the unique vertices. A degree-3 vertex must go to a degree-3 vertex, so 1 goes to r and 5 goes to t.
Follow the edges out. The only neighbour of 5 is 4, and the only neighbour of t is s, so 4 goes to s.
Place the rest. 2 and 3 must go to p and q. Try 2 to p and 3 to q.
Check every edge: 1-2 becomes r-p, 1-3 becomes r-q, 1-4 becomes r-s, 2-3 becomes p-q, 4-5 becomes s-t. All five are edges of H.
The map is one-to-one and both graphs have five edges, so no edge of H is left over: G and H are isomorphic. The swap 2 to q, 3 to p also works.
The same vertex-by-vertex habit helps when you hunt for a Hamiltonian cycle in a graph. If the words bijection, degree or bipartite still feel shaky, the Fermi Concept Library gives every concept in mathematics its own lesson and its place in the map.
Is there a fast test for every pair of graphs?
No polynomial-time test is known. Whether graph isomorphism can be decided in polynomial time is a major unsolved problem in computer science (Graph isomorphism, Wikipedia). In December 2015 László Babai posted a paper on arXiv giving an algorithm that solves it in quasipolynomial time; the best previous bound, by Eugene Luks, dated from 1983 (Babai, arXiv:1512.03547). For special families such as planar graphs, polynomial-time algorithms are already known (MathWorld).
For textbook-sized graphs the routine above is enough: invariants to rule out, a degree-guided map to rule in. To practise it on more pairs, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer.



