Proofs: Hopcroft-Tarjan planar isomorphism algorithm
These are the human proofs of Hopcroft-Tarjan planar isomorphism algorithm, at full length.
Dart refinement decides isomorphism of 3-connected planar graphs full
This proof shows: correctness, termination.
Setting. A map is a connected simple graph with a rotation system. Its darts are the ordered pairs with an edge; where follows in the rotation of , and . A map isomorphism is a bijection with and . The algorithm works on the disjoint union , where and act on each side separately. A partition of is stable when, for every block , both and are unions of blocks; equivalently, darts in one block have their -images in one block and their -images in one block.
Lemma 1 (refine computes the coarsest stable refinement). Given a partition and a queue that contains every block, or that contains enough blocks that every block of outside the queue is already a union of preimages as described below, REFINE stops and returns the coarsest stable partition finer than .
Proof. Termination: each split increases the number of blocks, which is at most , and each loop iteration removes one queue entry, while entries are added only at splits. Never too fine: let be any stable partition finer than . Suppose all blocks so far are unions of blocks of . A split cuts a block into and for a block and . Since is a union of -blocks and is stable, is a union of -blocks, so both pieces are too. Stable at the end: this is Hopcroft's argument. Invariant: for every current block and , is a union of blocks, or is in the queue, or is one piece of a split where is already a union of blocks and is in the queue. In the last case , and after is processed every block lies inside or outside , so is a union of blocks. The code keeps the invariant: when a queued block splits, both pieces are queued; otherwise the smaller piece is queued and the other is covered by the third case. When the queue is empty, the invariant gives stability.
Lemma 2 (invariance). Let be a map isomorphism , and let be the partition of into the pairs , . Then is stable, and if every block of a partition is a union of such pairs, so is every block of the coarsest stable refinement of .
Proof. maps the pair to , another pair; the same holds for . Since and are permutations, preimages of pairs are pairs too, so is stable. If is coarser than , then is a stable partition finer than , and the coarsest stable refinement of is coarser than every such partition, by Lemma 1.
The initial blocks of L1 are unions of pairs, since keeps the degree of the tail (the length of the -cycle) and the length of the face (the -cycle). So after L2 every block is a union of pairs of .
Lemma 3 (pairs give isomorphisms). If a stable partition has every block of the form with and , then is a map isomorphism, and is a well defined graph isomorphism.
Proof. is a bijection. Stability says and lie in one block, which must be since keeps sides, so ; the same for . The darts with tail form one -cycle, which maps onto one -cycle, so is well defined and a bijection on vertices. An edge gives the dart and with , so and is an edge.
Lemma 4 (one dart decides). In a connected map, and generate a group that acts transitively on the darts. If a map isomorphism with exists, refining after the pair is individualized ends with exactly the partition .
Proof. From , reaches every dart with tail and moves to a dart with tail ; by connectivity every dart of the map is reached, so every dart of is and every dart of is for words in and their inverses. In a stable partition , darts in one block have their images under in one block, and since is a power of , also their images under ; the same for . So if is a block of and shares a block with , then shares a block with , so and . Hence the result of the refinement is finer than . The starting partition is a union of pairs (the remark after Lemma 2, and is a pair), so by Lemma 2 is also coarser than .
Theorem (map isomorphism). MAP-ISOMORPHISM returns a vertex bijection induced by a map isomorphism if one exists, and None otherwise.
Proof. If it returns , the check in L7 and Lemma 3 show that comes from a map isomorphism. Conversely, let be a map isomorphism. By Lemma 2 every block after L2 is a union of pairs , so each block has equally many darts from each side and L3 does not reject. The block chosen in L4 contains and , and L5 tries every dart of in it, including ; by Lemma 4 that trial succeeds, so some trial returns. If no map isomorphism exists, no trial can pass L7 by Lemma 3, and the algorithm returns None in L8 or rejects in L3.
Theorem (3-connected planar graphs). For 3-connected planar graphs with planar rotation systems , TRICONNECTED-PLANAR-ISOMORPHISM returns an isomorphism exactly when .
Proof. Any returned is a graph isomorphism by Lemma 3. Conversely, let be an isomorphism. Transporting along gives a planar rotation system of . By Whitney's theorem, a 3-connected planar graph has only one planar embedding up to reflection, so this system equals or its mirror. Then induces a map isomorphism or , and one of the two calls succeeds by the theorem above.
Termination. REFINE terminates by Lemma 1; the trial loop runs at most times; there are two calls.