This is more or less obvious that the board of the 15 puzzle might be abstracted to a 4x4 graph every counter position corresponding to a node. Edges indicate possible puzzle moves, i.e. moves of the empty square. Less obvious is that the graph is bipartite. There is nothing to prepare you for this fact. Even as I write this I feel a tinge of surprise. How could one think of separating a solid puzzle into two parts without damaging the board? Do you feel the power of abstraction? Power may be a wrong word or be wasted fruitlessly unless a benefit is gained by looking at the puzzle as a game on a graph. And a benefit there is as I plan to demonstrate shortly. But abstracting the board is obviously not enough. We still have to shift the counters as stipulated by the rules.
Theorem
Let G be a simple nonseparable graph other than a polygon or the graph shown at right. Then puz(G) is connected unless G is bipartite, in which case puz(G) has exactly two components. In the latter case, labelings f and g on G having unoccupied
vertices at even (respectively, odd) distance in G are in the same component of puz(G) iff fg-1 is
an even (respectively, odd) permutation of V(G). For the exceptional case of the graph on the right, puz(G) has exactly 6 components.

The proof gets quite technical but the formulation itself has a very intuitive appeal. The distance between two nodes is of course
the length of the shortest walk from one node to another.
So that, except for the notion of permutation
which I am going to define on the next page, we are all set up to interpret the result. But note right away that the theorem completely resolves
the problem for the 15 puzzle and its generalizations to the nxn board with n
4. The board's graph is always bipartite.
Hence puz(G) has two components. Swapping two adjacent counters makes the labelings incompatible - belonging to different connected components of puz(G). The same applies
to the Lucky 7 puzzle with n = 7, 11, 15, etc.
Swapping two counters means applying a transposition to a labeling. Moving the empty square is equivalent to applying a sequence
of transpositions, the number of transpositions being equal to the number of moves or to the distance between the starting and final locations of the empty square. The theorem
then states that if two labelings have the same parity they belong to the same component of puz(G) iff the distance between empty squares in the two labelings is even.
If two labelings have different parities they belong to the same component of puz(G) iff the distance between empty squares in the two labelings is odd.

Reference
- E.R.Berlekamp, J.H.Conway, R.K.Guy, Winning Ways for Your Mathematical Plays, Academic Press, 1982.
- W.E.Story, Note on the '15' puzzle, Amer. J. Math., 2 (1879), 399-404.
- R.J.Wilson, Graphs And Their Uses, MAA, New Math Library, 1990.
- R.M.Wilson, Graph Puzzles, Homotopy, and the Alternating Group, J. of Combinatorial Theory, Ser B 16, 86-96 (1974).

- Graphs
- Three Glass Puzzle (example)