Algorithm and Experiments in Testing Planar Graphs For Isomorphism
Algorithm and Experiments in Testing Planar Graphs For Isomorphism
net/publication/220639549
CITATIONS READS
25 205
3 authors, including:
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Diane J. Cook on 19 November 2020.
Abstract
We give an algorithm for isomorphism testing of planar graphs suitable
for practical implementation. The algorithm is based on the decomposi-
tion of a graph into biconnected components and further into SPQR-trees.
We provide a proof of the algorithm’s correctness and a complexity analy-
sis. We determine the conditions in which the implemented algorithm out-
performs other graph matchers, which do not impose topological restric-
tions on graphs. We report experiments with our planar graph matcher
tested against McKay’s, Ullmann’s, and SUBDUE’s (a graph-based data
mining system) graph matchers.
This research is sponsored by the Air Force Rome Laboratory under contract F30602-
01-2-0570. The views and conclusions contained in this document are those of the
authors and should not be interpreted as necessarily representing the official policies,
either expressed or implied of the Rome Laboratory, or the United States Government.
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 314
1 Introduction
Presently there is no known polynomial time algorithm for testing if two gen-
eral graphs are isomorphic [13, 23, 30, 31, 43]. The complexity of known al-
gorithms are O(n!n3 ) Ullmann [12, 47] and O(n!n) Schmidt and Druffel [44].
Reduction of the complexity can be achieved with randomized algorithms at
a cost of a probable failure. Babai and Kŭcera [4], for instance, discuss the
construction of canonical labelling of graphs in linear average time. Their
method of constructing canonical labelling can assist in isomorphism testing
with exp(−cn log n/ log log n) probability of failure. For other fast solutions re-
searchers turned to algorithms which work on graphs with imposed restrictions.
For instance, Galil et al. [21] discuss an O(n3 log n) algorithm for graphs with
at most three edges incident with every vertex. These restrictions limit the
application in practical problems. We recognize planar graphs as a large class
for which fast isomorphism checking could find practical use.
The motivation was to see if a planar graph matcher can be used to improve
graph data mining systems. Several of those systems extensively use isomor-
phism testing. Kuramochi and Karypis [32] implemented the FSG system for
finding all frequent subgraphs in large graph databases. SUBDUE [10, 11] is
another knowledge discovery system, which uses labeled graphs to represent
data. SUBDUE is also looking for frequent subgraphs. The algorithm starts
by finding all vertices with the same label. SUBDUE maintains a linked list
of the best subgraphs found so far in computations. Yan and Han introduced
gSpan [51], which does not require candidate generation to discover frequent
substructures. The authors combine depth first search and lexicographic order
in their algorithm.
While the input graph to these systems may not be planar, many of the
isomorphism tests involve subgraphs that are planar. Since planarity can be
tested in linear time [7, 8, 27], we were interested in understanding if introducing
planarity testing followed by planar isomorphism testing would improve the
performance of graph data mining systems.
Planar graph isomorphism appeared especially interesting after Hopcroft
and Wong published a paper pointing at the possibility of a linear time algo-
rithm [28]. In their conclusions the authors emphasized the theoretical character
of their paper. They also indicated a very large constant for their algorithm.
Our work takes a practical approach. The interest is in an algorithm for testing
planar graph isomorphism which could find practical implementation. We want
to know if such an implementation can outperform graph matchers designed for
general graphs and in what circumstances. Although planar isomorphism test-
ing has been addressed several times theoretically [19, 25, 28], even in a parallel
version [22, 29, 42], to our knowledge, no planar graph matcher implementation
existed. The reason might be due to complexity. The linear time implementation
of embedding and decomposition of planar graphs into triconnected components
was only recently made available. In this paper, we describe our implementation
of a planar graph isomorphism algorithm of complexity O(n2 ). This might be a
step toward achieving the theoretical linear time bound described by Hopcroft
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 315
The upper bound for the isomorphism test of strongly regular graphs is
1/3
n(O(n log n)) [45]. If the degree of every vertex in the graph is bounded, the-
oretically, the graph can be tested for isomorphism in polynomial time [35]. If
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 316
the order of the edges around every vertex is enforced within a graph, the graph
can be tested for isomorphism in O(n2 ) time [31]. The subgraph isomorphism
problem was also studied on graphs with topological restrictions. For example,
we can find in O(nk+2 ) time if k-connected partial k-tree is isomorphic to a sub-
graph of another partial k-tree [14]. We focus in this paper on planar graphs.
Theoretical research [28] indicates a linear time complexity for testing planar
graphs isomorphism.
2.2 Definitions
All the concepts presented in the paper refer to an unlabeled graph G = (V, E)
where V is the set of unlabeled vertices and E is the set of unlabeled edges. An
articulation point is a vertex in a connected graph that when removed from the
graph makes it disconnected. A biconnected graph is a connected graph without
articulation points. A separation pair contains two vertices that when removed
make the graph disconnected. A triconnected graph is a graph without separa-
tion pairs. An embedding of a planar graph is an order of edges around every
vertex in a graph which allows the graph to be drawn on a plane without any
two edges crossed. A code is a sequence of integers. Throughout the paper we
use a code to represent a graph. We also assign a code to an edge or a vertex of
a graph. Two codes C A = [xA A A B B B B
1 , . . . , xi , . . . , xna ] and C = [x1 , . . . , xi , . . . , xnb ]
A B
are equal if and only if they are the same length and for all i, xi = xi . Sorting
codes (sorted codes) C A , C B , . . . , C Z means to rearrange their order lexicograph-
ically (like words in a dictionary). For the convenience of our implementation,
while sorting codes, we place short codes before long codes.
Let G be an undirected planar graph and ua(1) , . . . , ua(n) be the articulation
points of G. Articulation points split G into biconnected subgraphs G1 , . . . , Gk .
Each subgraph Gi shares one articulation point ua(i) with some other subgraph
Gj . Let biconnected tree T be a tree made from two kinds of nodes: (1) bi-
connected nodes B1 , . . . , Bk that correspond to biconnected subgraphs and (2)
articulation nodes va(1) , . . . , va(n) that correspond to articulation points. An
articulation node va(i) is adjacent to biconnected nodes Bl , . . . , Bm if corre-
sponding subgraphs Bl , . . . , Bm of G share common articulation point ua(i) .
V4 V3 V3 V4
V5 V5
V1 V2 V2 V1
(a) (b)
It starts by replacing every edge with two directed edges in opposite directions
to each other as shown in Fig. 2(a). This ensures an even number of edges
incident on every vertex and according to Euler’s theorem, every edge can be
traversed exactly once in a tour that starts and finishes at the same vertex.
During the tour we enter a vertex on an input edge and leave on the output
edge. The first edge to the right of the input edge is the first edge you encounter
in a counterclockwise direction from the input edge. Since we commit to only
one of the two embeddings, this first edge to the right is determined without
ambiguity. In the data structures the embedding is represented as an adjacency
list such that the counterclockwise order of edges around a vertex corresponds to
the sequence they appear in the list; the first edge to the right means to take the
consecutive edge from the adjacency list. During the tour, every newly-visited
vertex is assigned a consecutive natural number. This number is concatenated
to the list of numbers creating a code. If a visited vertex is encountered, an
existing integer is added to the code. The tour is performed according to three
rules:
1. When a new vertex is reached, exit this vertex on the first edge to the
right.
2. When a previously visited vertex is encountered on an edge for which the
reverse edge was not used, exit along the reverse edge.
3. When a previously visited vertex is reached on an edge for which the
reverse edge was already used, exit the vertex on the first unused edge to
the right.
with every new vertex exiting on the first edge to the right and every visited
vertex reached on an edge for which the reverse edge was already used on a first
unused edge to the right. Accordingly, we exit mentioned vertices to the left
while constructing code going left (code left). Constructing code right and code
left on a triconnected graph gives two codes that are the same as the two codes
constructed using only code right rules for an embedding of a triconnected graph
and an embedding of a mirror image of this graph. Having constructed codes
for all edges, they can be sorted lexicographically. Every planar triconnected
graph with m edges and n vertices has 4m codes of length 2m+1 [48]. Since
the graph is planar m does not exceed 3n − 6. Every entry of the code is an
integer in the range from 1 to n. We can store codes in matrix M . Using Radix
Sort with linear Counting Sort to sort codes in each row, we achieve O(n2 )
time for lexicographic sorting. The smallest code (the first row in M ) uniquely
represents the triconnected graph and can be used for isomorphism testing with
another triconnected graph with a code constructed according to the same rules.
4
7
8 9 3 2
2 5 2 3
10 15
15 11 10 11
2 9
12 1 12
1 3 5
13 14
6 1 5
1 16 3 13
14 16 8
4 7
1 4 1 4
5 6
Figure 2: Weinberg’s method of code construction for selected edge of the tri-
connected planar graph.
2.5 SPQR-trees
The data structure known as the SPQR-trees is a modification of Hopcroft and
Tarjan’s algorithm for decomposing a graph into triconnected components [26].
SPQR-trees have been used in graph drawing [49], planarity testing [15], and
in counting embeddings of planar graphs [18]. They can also be used to con-
struct a unique code for planar biconnected graphs. SPQR-trees decompose a
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 319
Trivial Case: If G consists of exactly two parallel edges between s and t, then
T consists of a single Q-node whose skeleton is G itself.
Parallel Case: If the spit pair {s, t} has at least three split components G1 , . . .,
Gk (k ≥ 3), the root of T is a P-node µ, whose skeleton consists of k
parallel edges e = e1 , . . . , ek between s and t.
Series Case: Otherwise, the spit pair {s,t} has exactly two split components,
one of them is the reference edge e, and we denote the other split com-
ponent by G′ . If G′ has cutvertices c1 , . . . , ck−1 (k ≥ 2) that partition G
into its blocks G1 , . . . , Gk , in this order from s to t, the root of T is an
S-node µ, whose skeleton is the cycle e0 , e1 , . . . , ek , where e0 = e, c0 = s,
ck = t, and ei = (ci−1 , ci ) (i = 1, . . . , k).
Rigid Case: If none of the above cases applies, let {s1 , t1 }, . . . , {sk , tk } be the
maximal split pairs of G with respect to s, t (k ≥ 1), and, for i = 1, . . . , k,
let Gi be the union of all the split components of {si , ti } but the one
containing the reference edge e = (s, t). The root of T is an R-node µ,
whose skeleton is obtained from G by replacing each subgraph Gi with
the edge ei = (si , ti ).
Several lemmas discussed in related papers are important to our topic. They
are true for a biconnected graph G.
Lemma 2.2 [17] The skeletons of the nodes of SPQR-tree T are homeomorphic
to subgraphs of G. Also, the union of the sets of spit pairs of the skeletons of
the nodes of T is equal to the set of split pairs of G.
Lemma 2.3 [26, 36] The triconnected components of a graph G are unique.
Lemma 2.4 [17] Two S-nodes cannot be adjacent in T . Two P -nodes cannot
be adjacent in T .
3 The Algorithm
V3
V0 V1 V6
V7
V5
V8
V2 V4
V9
S0
V3
V0 V1
reference e2 e4
e1 V2 e3
T01 Tr01 T02 Tr02
P1 P2
V2 V1
V0 V2 V1 V6
V0 V2
V7
V5 V8 V9
V2 V4
in order to give a code for T01 . There are two virtual edges of P 1 directed from
vertex V 2 to vertex V 0 that correspond to the further graph decomposition.
They are identified by tails of T13 and T14 . Therefore, codes T13 and T14 must
be computed before completing the code of T01 . T13 points to node S3. It is
a circle with three vertices and six edges, which is not further decomposed. If
multi-edges are not allowed, S0 can be represented uniquely by the number of
edges of S3’s skeleton. Since S3’s skeleton has 6 edges, its unique code can be
given as T13 =S (number of edges)S =S (6)S . Similarly T14 = S (8)S . Now the
code for P 1 can be determined. The P 1 skeleton has eight edges, including six
virtual edges. Therefore, T01 =P (8, 6, T13 , T14 )P , where T13 ≤ T14 . Applying
the same recursive procedure to T r01 gives T r01 =T01 =P (8, 6, T r13 , T r14 )P .
Because of graph symmetry T01 = T r01 . Codes T02 and T r02 complete the
list of four codes associated with four virtual edges of S0. The codes T02 and
T r02 contain the code for R node starting from symbol ‘R (’ and finishing with
‘)R ’. The code of biconnected component R5 is computed according to Wein-
berg’s procedure. In order to find T25 , codes for “going right” and “going left”
are found. Code going right of T25 is smaller than code going left therefore
we select code going right. T25 and T r25 are the same. The following integer
numbers are assigned to vertices of R5 in the code going to the right of T r25 :
V 2 = 1, V 1 = 2, V 7 = 3, V 4 = 4, V 6 = 5. The ‘ ∗ ’ after number 5 indicates
that at this point we reached the articulation point (vertex V 6) through which
the biconnected graph is connected to the rest of graph structure. The codes
associated with S0’s virtual edges after sorting:
First, we add the number of edges of S0 to the beginning of the code. There
are eight edges. We need to select one edge from those eight. This edge will
be the starting edge for building a unique code. Restricting our attention to
virtual edges narrows the set of possible edges to four. Further we can restrict
our attention to two virtual edges with the smallest codes (here based on the
length of the code). Since T01 and T r01 are equal and are the smallest among
all codes associated with the virtual edges of S0, we do code construction for
two cases. We traverse the S0 edges in the direction determined by the start-
ing edge e2 associated with tail of T01 , until we come back to the edge from
which we began. The third and fourth edges of this tour are virtual edges. We
introduce this information into a code adding numbers 3 and 4. Next, we add
codes associated with virtual edges in the order they were visited. We have two
candidate codes for the final code of the biconnected graph from our example:
We find that Code(e1 ) < Code(e2 ), therefore e1 is the reference and starting
edge of the code. e1 is also the unique edge within the biconnected graph from
the example. Code(e1 ) is the unique code for the graph and can be used for
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 324
isomorphism testing with another biconnected graph. The symbols ‘P (’, ‘)P ’,
‘S (’, ‘)S ’, ‘R (’, and ‘)R ’ are integral part of the codes. They are organized in the
order:
‘P (’ < ‘)P ’ < ‘S (’ < ‘)S ’ < ‘R (’ < ‘)R ’
code in two aspects. (1) the way the starting reference edge
is selected. In non-root nodes the starting edge is the one as-
sociated with the input (edge einput ). Given an input edge,
there is only one code. There is no need to consider multi-
ple cases. (2) Only virtual edges different from einput are considered when
concatenating the codes.
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 325
Table 1: (cont).
Type P
Root P node: Find the number of edges and number of
virtual edges in the skeleton of P . Add number of edges to
the code first and number of virtual edges second. If A and B
are the skeleton’s vertices, construct the code for all virtual
edges in one direction, from A to B. Add codes of all virtual
edges directed from A to B to the code of the P root node.
Added codes should be in non-decreasing order. If A or B is an articulation
point add a mark to the code indicating if articulation point is at the head
or at the tail of the edge directed from A to B. Construct the second code
following the direction from B to A. Compare the two codes. The smaller
code is the code of P root node.
Non-root P node: Construct the code in the
input same way as for the root P node but only in one
input direction. The input edge determines the direc-
tion.
Type R
Root R node: For all virtual edges of an R root node, find
the codes associated with them. Find the smallest code. Se-
lect all edges for which codes are equal to the smallest one.
They are the starting edges. For every edge from this set
construct a code according to Weinberg’s procedure. When-
ever a virtual edge is traversed, concatenate its code. For
every edge, two cases are considered: “going right” and “going left”. Finally,
choose the smallest code to represent the R root node. If at any point in a
tour an articulation point is encountered, mark this point in the code.
Non-root R node: Only two cases need to be considered
input (“going right” and “going left”), because the starting edge is
input found based on input edge to the node. Only virtual edges
different from einput are considered when concatenating the
codes.
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 326
18
17
14 15 16
12 13
11
10 9
7 8
4 5 6
0 1 2 3
Code construction for a planar graph begins from the leaves of a biconnected
tree and progresses in iterations. We compute codes for all leaves, which are bi-
connected components in the first iteration. Leaves are easily identified because
they have only one edge of a tree incident on them. Leaves can be deleted, and
in the next iteration we compute the code for articulation points. Once we have
codes for articulation points, the vertices can be deleted from the tree. We are
left with a tree that has new leaves. They are again biconnected components.
This time, codes found for articulation points are included into the codes for
biconnected components. This inclusion reflects how components are connected
to the rest of the graph through articulation points. In the last iteration only
one vertex of the biconnected tree is left. It will be either an articulation point
or a biconnected component. In general, trees can have a center containing
one or two vertices, but a tree of biconnected components always has only one
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 327
B9
a) 18 b) c)
Code(17)=A{B9}A
17
B7
B7 17
17 B8 Code(15)=A{B8}A
14 15
14 15 15 16
13
13
Code(13)=A{B7}A
B6 B6
13 13 B6
13
B5
9 9
12
9
11 9
10
B4
9 B4
9 Code(9)=A{B5, B4}A
7 8
B3 7 8 B5<B4
0 4 4 5 B2
4 5
5 6
B0 B1 Code(4)=
5 5
A{B3}A
Code(5)=A{B0, B2, B1}A
B0<B2<B1
1 2 3
Figure 5: Constructing a unique code of a planar graph (a) the tree of bicon-
nected components, (b) after the first iteration of the algorithm with leaves
eliminated (c) before the last iteration of the algorithm
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 328
center vertex. Computing the code for this last vertex gives the unique code of
a planar graph.
In the example given in Fig. 5(a) we identify the leaves of the tree first and
find codes for them. They are: B0, B1, B2, B3, B5, B8, B9. Let those symbols
also denote codes for those components. These codes include information about
articulation points. For example, B1=B (S (6∗ )S )B . ‘B (’ and ‘)B ’ mark the be-
ginning and the end of a biconnected component code. B1 contains only a circle
with one articulation point. ‘ ∗ ’ denotes the articulation point, and 6 represents
six edges in this component after replacing every edge in the graph with two
edges in opposite directions. After codes for the leaves of the biconnected tree
are computed, those vertices are no longer needed and can be deleted. Fig. 5(b)
presents the remaining portion of the biconnected tree. Codes for articulation
points 4, 5, 15, and 17 can be computed at this point. All codes of the vertices
adjacent to a given articulation point are sorted and concatenated in nonde-
creasing order. Codes for articulation points 15 and 17 are just the same codes
as adjacent leaves B8 and B9 with symbol ‘A (’ at the beginning and ‘)A ’ at the
end. The symbols ‘A (’ and ‘)A ’ together with ‘B (’ and ‘)B ’ add up to total eight
control symbols. Their order is:
‘A (’ < ‘)A ’ < ‘B (’ < ‘)B ’ < ‘P (’ < ‘)P ’ < ‘S (’ < ‘)S ’ < ‘R (’ < ‘)R ’
Constructing Code(5) requires sorting codes B0, B1, and B2 and concatenating
them in the order B0 ≤ B2 ≤ B1. Code(5)=A (B0, B2, B1)A . The codes for
articulation points 9 and 13 are not know, because not all necessary codes
were found at this point. In the second iteration codes for B4 and B7 can be
computed. B4 and B7 are circles, therefore the rules for creating codes of S
root vertices from the preceding section apply. The previously found codes of
articulation points must be included in the newly created codes of B4 and B7.
B4’s skeleton has 10 edges, therefore we place the number 10 after the symbol
‘S (’. The reference edge, selected based on the smallest code in B4’s skeleton,
is the edge directed from vertex 8 to vertex 9. The very first vertex after the
reference edge is an articulation point (vertex 9). This adds the number 1 with
a ‘ ∗ ’ to the code since this articulation point does not have any code associated
with it. After traversing three edges in the direction determined by the reference
edge, we find another articulation point (vertex 4). Number 3 is placed next in
the B4 code and is followed by the code of the encountered articulation point.
The next articulation point (vertex 5) is fourth in the tour, so we concatenate
the number 4 and the code for this articulation point, which completes the code
for B4. The B7 code can be found in a similar way. B4 and B7 are:
In the next iteration we compute codes for articulation points, vertices 13 and
9. This step is the same as the previous one where codes for articulation points
with vertices 4, 5, 16, and 17 were computed. The codes are:
Code(9)=A (B7)A
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 329
After this step, the graph from our example is reduced to one biconnected
component shown in Fig. 5(c). The code of B6 is the final code that uniquely
represents the graph from our example. The undirected edge between vertices 9
and 13 is the unique edge of this graph. The B6 code can be used for testing the
graph for isomorphism with another planar graph. Given the order of control
symbols we find that A (B7)A ≤ A (B5, B4)A , therefore the final planar graph
code is
The presented method of code construction for planar graphs will produce
the same codes for all isomorphic graphs and different codes for non-isomorphic
graphs. The correctness results from the uniqueness of decomposition of a planar
graph into biconnected components and biconnected components into SPQR-
trees. Two isomorphic biconnected graphs will have the same SPQR-trees. If
additionally all the skeletons of corresponding nodes of SPQR-trees are the same
and preserve the same connections between virtual edges, than the graphs rep-
resented by those trees are isomorphic. Similarly, two isomorphic planar graphs
will have the same biconnected tree. If the corresponding biconnected compo-
nents of this tree are isomorphic and the connection of them to articulation
points is preserved, the two planar graphs are isomorphic. For the proof see the
Appendix.
4 Experiments
The purpose of the experiments is to compare the planar graph matcher de-
scribed in this paper with other graph matching systems. Three of them, which
do not impose topological constraints, were selected:
1. The SUBDUE Graph Matcher [10, 11] developed based on Bunke’s al-
gorithm [9]. This graph matcher is a part of the SUBDUE data mining
system and has a wide range of options. It can perform exact and inexact
graph matches on graphs with labeled vertices and edges. If the graphs
are non-isomorphic the program can return the lowest matching cost (cost
is the number of edges and vertices that must be removed from one graph
in order to make the two graphs isomorphic).
A desktop computer with a Pentium IV, 1700 MHz processor and 512 MB
RAM was used in the experiments. The tests were conducted on isomorphic
and non-isomorphic pairs of planar, undirected, unlabeled graphs. In all ex-
periments involving a planar graph matcher, the time spent for planarity test
was included in the total time used by the planar graph matcher. In order to
evaluate general properties of the graph matchers with respect to computation
time, a vast number of graphs were generated. We used LEDA [41] functions
that allow for generation of a planar graph with specified number of vertices
and edges.
In Fig. 6 we show the average computation time versus the number of edges
for planar graphs with 20, 50 and 80 vertices. McKay’s, Ullmann’s, SUBDUE,
and the planar graph matcher are compared. The results in Fig. 6 were found
based on one thousand isomorphic pairs of randomly generated, connected pla-
nar graphs. The number of edges of every generated graph was also random.
Graphs were generated in the range of edges from |V |-1 to 3|V |-6. This range
was divided into 17 intervals. Every point marked in Fig. 6 represents aver-
age computation time within one of the 17 intervals. The two vertical arrows
in Fig. 6 indicate points where Ullmann’s algorithm is 20 times slower than
McKay’s and the planar graph matcher is 400 times slower. The planar graph
matcher was outperformed by three other general graph matchers on planar
graphs with 20 vertices. The average code length of the 1000 graphs with 20
vertices used in the experiment was 195 symbols.
Comparing computation time for isomorphic and non-isomorphic graphs in
Fig. 6, we observe a significant drop in computation time for non-isomorphic
graphs while using Ullmann’s algorithm. We do not observe such differences for
testing non-isomorphic and isomorphic graphs when we use McKay, SUBDUE
or planar graph matcher. The runtime of McKay’s graph matcher decreases
with an increasing number of edges in all experiments in Fig. 6 and 7. This
is due to two reasons [37]. First, major computation time of Mckay’s graph
matcher is spent on determining the automorphism group of a graph. There are
fewer automorphisms as we approach the upper limit on the number of edges of
planar graphs 3|V | − 6, and therefore faster computation time. Second, Mckay’s
graph matcher is optimized for dense graphs in many of its components.
We excluded SUBDUE from experiments on graphs bigger than 20 vertices
and Ullmann’s graph matchers from experiments on graphs bigger than 80 ver-
tices, because their testing time was too long. In Fig. 7 we compare testing time
of McKay’s and the planar graph matcher with 200, 1000, and 3000 vertices. In
each of these three cases one thousand randomly generated planar, connected
graphs were used in the experiment. We present results only for isomorphic
graphs because we consider them to be the hardest, resulting in the longest
computation time. Fig. 7(a) shows the execution time measured for every pair
of graphs tested for isomorphism. Fig. 7(b) gives the average of the values from
Fig. 7(a). McKay’s graph matcher is faster as the number of edges in the graph
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 331
0
10
a) isomorphic graphs |V| = 20 vertices
10
0
b) nonisomorphc graphs
-1 -1
10 Planar 10
Matcher
-2 -2
10 10
-3 Subdue -3
10 10
-4 Ullman -4
10 10
x400 x20
-5 McKay -5
10 10
25 30 35 40 45 50 55 25 30 35 40 45 50 55
0
|E| - edges |E| - edges
10 |V| = 50 vertices
10
0
-1
10 Planar -1
10
Matcher
-2 -2
10 10
-3 -3
10 10
Ullman
-4 -4
10 10
McKay
-5 -5
10 10
60 80 100 120 140 60 80 100 120 140
-1 -1
10 10
Ullman
-2 -2
10 10
McKay
-3 -3
10 10
-4 -4
10 10
100 120 140 160 180 200 220 240 100 120 140 160 180 200 220 240
|E| - edges |E| - edges
Figure 6: Average execution time of three general graph matchers and our
planar graph matcher for testing isomorphism of planar graphs with 20, 50 and
80 vertices.
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 332
0.35 0.7
0.25
Matcher 0.5
0.2 0.4
0.15 0.3
0.1 0.2
0.05
McKay
0.1
0 0
250 300 350 400 450 500 550 600 250 300 350 400 450 500 550 600
|E| - edges |E| - edges
|V|=1000 vertices
9
6
8
McKay
7 5
6
Planar 4
5 Matcher
3
4
3 2
2
1
1
0 0
1500 2000 2500 3000 1500 2000 2500 3000
160 McKay
140
120 100
100
80
60
Planar 50
Matcher
40
20
0 0
4000 5000 6000 7000 8000 9000 4000 5000 6000 7000 8000 9000
|E| - edges |E| - edges
Figure 7: Execution time of McKay’s and Planar Graph matcher: (a) raw data
(b) average time.
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 333
increases, and it performs especially well on dense planar graphs. When ex-
amining the execution time of the planar graph matcher in Fig. 7(a), we find
that there is a minimum time (about one second) required to check two graphs
for isomorphism by the planar graph matcher. We do not observe any cases
with smaller execution time. This minimum time represents cases of the graphs
tested for isomorphism in linear time. This time is spent on planarity test, de-
composition into biconnected components, decomposition into SPQR-trees, and
for the most part, for the construction of the code that represents the graph.
Code construction is computationally very costly if computations start from a
triconnected root node or if the graph is triconnected and cannot be decom-
posed further. These cases are more frequent as the number of edges in planar
graph approaches |E| = 3|V | − 6. We apply Weinberg’s [48] procedure of O(n2 )
complexity to these cases. It results in significant increase in computation time
for dense planar graphs observed both in Fig. 6 and Fig. 7.
In Table 2 we collect average computation time for pairs of graphs with
10, 20, 50 and 80 vertices, both isomorphic and non-isomorphic. Table 3 gives
average time for isomorphic pairs of graphs with 200, 500, 1000, 2000 and 3000
vertices. Every entry in Table 2 and Table 3 is computed based on 1000 graphs.
Number of edges for every graph is found randomly from the range |V | − 1 ≤
|E| ≤ 3|V | − 6.
Average time taken to test isomorphic graphs from these tables was used to
plot Fig. 8. The isomorphism test time used by the planar graph matcher with
graphs in the range of 10 to 3000 vertices increases almost linearly with number
of vertices. On average, the planar graph matcher is faster than McKay’s graph
matcher on graphs with more than 800 vertices.
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 334
2 Planar
50 Matcher
1.5 McKay
40 1
0.5
30
0
0 500 1000
20
10
0
0 500 1000 1500 2000 2500 3000
|V| - VERTICES
Figure 8: Average time (1000 pairs of isomorphic graphs for every point) of
testing isomorphic pairs of planar graphs with McKay and the planar graph
matcher.
PLANAR
MATCHER
IS FASTER
DISCONNECTED
GRAPHS
3000
2500
2000 McKay’s
ALGORITHM
IS FASTER
1500
NONPLANAR
1000
GRAPHS
500
0
0 1000 3000 5000 7000 9000
|E|-NUMBER OF EDGES
reach small graphs in the range of 10 or 20, the conclusion about introducing
the planar graph matcher to data mining systems would need to be revised.
The planar graph matcher could also be made more applicable by extension to
planar graphs with labels both on edges and on vertices. This, however, would
require longer graph codes.
The result presented here might be particularly useful, if any application
would arise, which would require testing planar graphs for isomorphism with
thousands of vertices. Electronic and Very Large Scale Integration (VLSI) cir-
cuits are examples [2] of such applications. The research in graph planariza-
tion [33] can extend the methods described here for isomorphism testing and
unique code construction to larger classes of graphs than planar.
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 337
APPENDIX
A The Algorithm
A.1 Pseudocode
The algorithm is divided into six parts (Algorithm 2-7) and ten procedures.
The first procedure ISOMORPHISM-TEST receives two graphs, G1 and G2,
computes codes for each of them, and compares the codes. Equal codes mean
that G1 and G2 are isomorphic, unequal codes mean that they are not. Pro-
cedure FIND-PLANAR-CODE accepts a planar graph G and returns its code.
First, G is decomposed into biconnected components (line 1). Biconnected tree
T represents this decomposition. The body of the main while loop (lines 2-12)
progresses iteratively finding the code associated with leaf nodes of T and artic-
ulation nodes. The loop at lines 3-5 finds codes for all biconnected components
of G associated with the leaf nodes of T . The codes are stored in the code array
C. C is indexed by T nodes. Every articulation point vA adjacent to the leaf
nodes of T is assigned a code at lines 6-10. Lines 7 and 9 mark in the code
the beginning ‘A (’ and the end ‘)A ’ of the code. Codes for articulation nodes
are stored in an A array. When only one node (the center node) is left in the
biconnected tree, the algorithm progresses to line 14. Lines 14-19 determine the
final planar code. If the center node is an articulation node, the final planar
code is retrieved from an A array. If the center node is a biconnected node, the
final code of the biconnected node is computed in line 18. Line 20 returns the
code of the planar graph.
Procedure FIND-BICONNECTED-CODE accepts a biconnected graph G
and an array A, which contains codes associated with articulation points. All
edges of G are replaced with two directed edges in opposite directions at line
1. Line 2 creates the SPQR-tree of G. Line 3 finds the center or two centers of
the SPQR-tree. If there is only one center node, the code L1 of G is computed
at line 4 starting from this center node and we return L1 . If the SPQR-tree
has two center nodes, the additional code L2 is found at line 8 starting from
the second center. Then, we return the smaller of L1 , L2 . Procedure FIND-
BICONNECTED-CODE-FROM-ROOT recognizes the type of center nodes and
calls procedures that compute the biconnected graph code using the SPQR-tree
data structure with P-, S-, or R- nodes in the center.
Procedure CODE-OF-S-ROOT-NODE accepts the skeleton of a center S-
node skeleton(µ), an array of codes associated with articulation points A, and
an SPQR-tree T . The loop at lines 1-3 uses the FIND-CODE procedure to find
codes associated with virtual edges. These codes represent remaining portions
of graph G adjacent to the S-center node. The parameter twin edge of (eV ) is
a virtual edge of the skeleton of a child of the center S-node. The loop at lines
4-23 creates code array CA. Each virtual edge of an S-node skeleton has its
corresponding code in CA. Line 5 appends symbol ‘S (’ to the code indicating
node type and the beginning of the code. Line 21 appends ‘)S ’ indicating the
end of the code. The internal loop at lines 9-21 traverses the skeleton circle and
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 338
FIND-BICONNECTED-CODES-FROM-ROOT(µ, A, T )
L -code for biconnected graph starting from root node µ
1: L.append( ”B (” )
2: if µ = S node then
3: L=CODE-OF-S-ROOT-NODE(skeleton(µ), A, T )
4: else if µ = P node then
5: L=CODE-OF-P-ROOT-NODE(skeleton(µ), A, T )
6: else if µ = R node then
7: L=CODE-OF-R-ROOT-NODE(skeleton(µ), A, T )
8: end if
9: L.append( ”)B ” )
10: return L
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 340
Algorithm 5 Constructing the unique code for P-root and R-root nodes of T
CODE-OF-P-ROOT-NODE(skeleton(µ), A, T )
{vA , vB } the vertices of the skeleton of a P-node
CA -code array indexed by vA , vB
CV -table of codes associated with virtual edges
1: for all v ∈ {vA , vB } of skeleton(µ) do
2: for all virtual edges eV directed out of v do
3: ν = the child of µ corresponding to virtual edge eV
CV [eV ]=FIND-CODE(twin edge of (eV ), skeleton(ν), A, T )
4: end for
5: CA[v].append( ”P (” )
6: CA[v].append( number of edges(skeleton(µ)) )
7: CA[v].append( number of virtual edges(skeleton(µ)) )
8: concatenate all codes from CV to CA in increasing order
9: if A[v] 6= N U LL then
10: CA[eV ].append( ” ∗ ” )
11: CA[eV ].append(A[v]), delete A[v] code from A
12: end if
13: CA[v].append( ”)P ” )
14: end for
15: return FIND-THE-SMALLEST-CODE(CA)
CODE-OF-R-ROOT-NODE(skeleton(µ), A, T )
CV -table of codes associated with virtual edges
CA -code array
1: for all virtual edges eV of skeleton(µ) including reverse edges do
2: ν = the child of µ corresponding to virtual edge eV
CV [eV ]=FIND-CODE(twin edge of (eV ), skeleton(ν), A, T )
3: end for
4: for all virtual edges eV of skeleton(µ) including reverse edges do
5: CA[eV ].append( ”R (” )
6: Apply Weinberg’s [48] procedure to find code associated with eV going
right CodeRight and going left CodeLef t. When virtual edge is encoun-
tered during the tour, append its code to CA[eV ]
7: if at any vertex v during Weinberg’s traversal A[v] 6= N U LL then
8: CA[eV ].append(A[v]) delete A[v] code from A
9: end if
10: CA[eV ]=FIND-THE-SMALLEST-CODE([CodeRight, CodeLef t])
11: CA[eV ].append( ”)R ” )
12: end for
13: return FIND-THE-SMALLEST-CODE(CA)
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 342
Algorithm 6 Constructing the unique code for S,P,R non root nodes of T
FIND-CODE(ein , skeleton(µ), A, T )
CV -table of codes associated with virtual edges
C -code
1: if µ = S node then
2: C.append( ”S (” )
3: C.append( number of edges(skeleton(µ)) )
4: eV = the edge following ein in the tour around the circle in the direction
given by ein
5: tour counter=1
6: while eV 6= ein do
7: if eV is a virtual edge then
8: ν = the child of µ corresponding to virtual edge eV
C.append(FIND-CODE(eV , skeleton(ν), A, T ))
9: end if
10: if A[tail vertex(eV )] 6= N U LL then
11: C.append( tour counter )
12: C.append( ” ∗ ” )
13: C.append(A[tail vertex(eV )]) delete A[tail vertex(eV )] code from A
{if code A[tail vertex(eV )] does not exist nothing is appended }
14: end if
15: eV = the edge following eV in the direction given by ein
16: tour counter=tour counter+1
17: end while
18: C.append( ”)S ” )
19: else if µ = P node then
20: for all virtual edges eV 6= ein directed the same as ein do
21: ν = the child of µ corresponding to virtual edge eV
CV [eV ]=FIND-CODE(twin edge of (eV ), skeleton(ν), A, T )
22: end for
23: C.append( ”P (” )
24: C.append( number of edges(skeleton(µ)) )
25: C.append( number of virtual edges(skeleton(µ)) )
26: concatenate all codes from CV to C in increasing order
27: if A[tail vertex(ein )] 6= N U LL then
28: C.append( ” ∗ ” )
29: C.append(A[tail vertex(ein )]), delete A[tail vertex(ein )] code from A
30: end if
31: C.append( ”)P ” )
32: else if µ = R node then
33: C=FIND-CODE-R-NON-ROOT(ein , skeleton(µ), A, T )
34: end if
35: return C
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 343
Algorithm 7 Constructing the unique code for R non root node of T and
finding the smallest code
FIND-CODE-R-NON-ROOT(ein , skeleton(µ), A, T )
CV -table of codes associated with virtual edges
C -code
1: for all virtual edges eV 6= ein do
2: ν = the child of µ corresponding to virtual edge eV
CV [eV ]=FIND-CODE(twin edge of (eV ), skeleton(ν), A, T )
3: end for
4: C.append( ”R (” )
5: Apply Weinberg’s [48] procedure to find code associated with ein going right
CodeRight and going left CodeLef t
6: if at any vertex v during Weinberg’s traversal A[v] 6= N U LL then
7: C.append(A[v]), delete A[v] from A
8: end if
9: if at any edge e 6= ein during Weinberg’s traversal CV [e] 6= N U LL then
10: C.append(CV [e])
11: end if
12: C=FIND-THE-SMALLEST-CODE([CodeRight, CodeLef t])
13: C.append( ”)R ” )
14: return C
FIND-THE-SMALLEST-CODE(CA)
1: Remove from CA all codes with length bigger than minimal code length in
CA
2: index=0
3: while CA has more than one code AND index <length of codes in CA do
4: Remove all codes from CA with smaller value of CA[Code[index]] than
minimum of
{CA[Code1[index]], CA[Code2[index]],. . . ,CA[CodeN [index]]}
5: index = index + 1
6: end while
7: return CA[first code]
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 344
appends to CA[eV ] codes associated with the virtual edges and the articulation
points. The procedure CODE-OF-S-ROOT-NODE returns the smallest code
from CA at line 24.
The procedure CODE-OF-P-ROOT-NODE in its main loop at lines 1-14
creates two codes stored in a CA array. In the first code, the virtual edges eV
are directed from vertex vA to vertex vB . This direction is used in the FIND-
CODE procedure called at line 3. Each of the two codes starts with symbol
‘P (’ at line 5. Next, we append the number of edges and number of virtual
edges at lines 6-7. We concatenate all codes associated with virtual edges in
increasing order at line 8. If vA or vB correspond to articulation points in the
original graph, we add this information at line 10. If the code associated with
this articulation point exists, we append it at line 11. At line 15 we return the
smaller of the two codes.
The procedure CODE-OF-R-ROOT-NODE starts from finding all codes as-
sociated with virtual edges at lines 1-3. Using Weinberg’s procedure we find
two codes: CodeRight for triconnected skeleton of the node starting from eV
and CodeLef t for mirror image of the skeleton also starting from eV . We find
the two codes starting from every virtual edge of the skeleton. We determine
the smallest among these codes and return it at line 13.
Algorithm 6 describes the FIND-CODE procedure. It is a recursive proce-
dure and it calls itself at lines 8, 21 and line 2 of FIND-CODE-R-NON-ROOT
procedure. FIND-CODE uses input edge ein and its direction as an initial edge
to create code for non-root nodes S, P, R. Code for an S-node is found at lines
1-18, for P-node at lines 19-31 and we call FIND-CODE-R-NON-ROOT at line
33 to find code for R-node. The algorithm for non-root nodes is similar as for
root nodes. In the case of non-root nodes we do not have ambiguity related to
lack of a starting edge because ein is the starting edge.
The procedure FIND-THE-SMALLEST-CODE accepts a code array CA.
We find the length of the shortest code and eliminate from CA all codes with
longer length at line 1. Then, in the remaining codes we find the minimum of
values at the first coordinate of the codes. We eliminate all codes that have
bigger value than minimum at the first coordinate. We do the same elimination
process for the second coordinate. We continue this process until only one code
is left in CA or until we reach the last coordinate. We return the first code in
CA.
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 345
Radix Sort, where codes can be ordered column by column using Counting
Sort, takes O(n2 ) time. Therefore, the complexity of finding minimum code
and lexicographical ordering with Radix Sort performed at every node of the
SPQR-tree together is not more than O(n2 ). 2
Lemma A.3 The construction of the code of a planar graph G by Algorithm
2-7 takes O(n2 ) time.
Proof Let B1 , . . . , Bk denote biconnected components of G. Let T be a bi-
connected tree of G. By Lemma A.2, constructing the code of the biconnected
component Bi , with mi vertices, associated with a leaf node of T takes O(mi 2 )
time. Also, the length of Bi code is O(mi ). At every step of Algorithms 2-3,
the length of a produced code has linear complexity with the number of vertices
of the subgraph this code represents. Let the times spent to produce the codes
of biconnected components B1 , . . . , Bk be given by O(m1 2 ), . . . , O(mk 2 ). Since
m1 + . . . + mk = n, and m1 2 + . . . + mk 2 ≤ (m1 + . . . + mk )2 , the total time spent
on construction of all codes of all biconnected components of G is O(n2 ). The
lexicographical ordering of the codes at articulation nodes requires the sorting
of biconnected codes of various lengths. The total number of sorted codes will
not exceed the number of edges of G because G is planar. The length of codes
are bound by O(n) and maximum value (integer) in the code is bounded by
O(n). All partial codes of G can be stored in an array of dimension O(n) by
O(n). Using Radix Sort with Counting Sort on every column of this table takes
O(n2 ) time. Sorting codes at all articulation nodes combined using Radix Sort,
do not exceed complexity of sorting O(n) by O(n) array. Therefore, the total
process of lexicographical ordering at all articulation nodes of T takes O(n2 )
time. Since constructing codes for all biconnected components takes O(n2 ) and
sorting subcodes of G at articulation points does not take more than O(n2 ), the
total time for constructing code for planar graph is O(n2 ). 2
Lemma A.4 The smaller of the two Weinberg’s codes:(1) a code of a tricon-
nected graph GR and (2) a code of the mirror image of GR , found by starting
from specified directed edge ein as the initial edge of GR , uniquely represents
GR .
Proof In the proof we refer to Weinberg’s paper [48]. It introduces code matri-
ces M1 and M2 respective to planar triconnected graphs G1 and G2 . Every row
in the matrices is a code obtained by starting from a specified edge. Matrices
M1 and M2 have size 4m × (2m + 1) (m-number of undirected edges of the
graph) because every triconnected graph has 4m codes of length 2m+1. The
codes in the matrices are ordered lexicographically. G1 and G2 are isomorphic
if and only if their code matrices are equal. It is also true that G1 and G2 are
isomorphic if and only if any row of M1 equals any row of M2 [48]. Therefore,
G1 with initial edge ein , and G2 with e′in that corresponds to ein are isomorphic
triconnected graphs if and only if the two codes of G1 (code of G1 and mirror
image of G1 ) started from directed initial edge ein , and ordered in increasing
order are equal to the two ordered codes of G2 started from e′in . We can select
the smaller of the two codes. Since only one code is sufficient for an isomorphism
test, the smallest code will uniquely represent a triconnected planar graph with
the initial edge ein . 2
Lemma A.5 The code produced by Algorithms 3-7 uniquely represents a bicon-
nected graph.
Leaf nodes.
Consider leaf nodes of T . Fig. 10 (reverse edges are omitted) shows skeletons
of a P-leaf-node and an S-leaf-node. In the Parallel Case of the SPQR-tree
definition we saw that the skeleton of a P-node consists of k parallel edges be-
tween the split pair {s, t}. Therefore, providing (1) the number of edges of the
skeleton and (2) the node type, is sufficient to uniquely represent a P-leaf-node
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 348
skeleton. Similarly, in the Series Case of the SPQR-tree definition we saw that
the S-node skeleton is a cycle e0 , e1 , . . . , ek . Providing (1) the number of edges
of the skeleton and (2) the node type is sufficient to uniquely represent an S-
leaf-node skeleton. By Lemma 2.1 the skeleton of an R-node is a triconnected
graph. Since the input edge ein to Algorithm 6 determines the initial edge,
by Lemma A.4 we can build a unique code to represent the skeleton of the
R-leaf-node using Weinberg’s method.
e1=ein e0=ein
s e2 t s t
ek e1 ek
e2
k edges k edges
Figure 10: The skeleton of a P-leaf-node (left) and the skeleton of an S-leaf-node
(right).
ein
remainder of G
s t
s t
skeleton(µl(1)) \ evirt
(a) (b)
Figure 11: (a) The skeleton of a P-node adjacent to leaves µl(1) , µl(2) , . . . , µl(k) of
an SPQR-tree and (b) split pair {s, t} of a P-node that splits G into subgraphs
with one-to-one correspondence to the skeletons of the leaves of an SPQR-tree.
e0 , represent the S-node adjacent to the leaves of T together with the leaf nodes
without ambiguity.
The skeleton of an R-node, by definition, is a triconnected graph. Wein-
berg’s method traverses each edge of the skeleton once in each direction on
Euler’s path. The initial edge of an Euler’s path is determined by the input
edge. The Eulerian path started from the initial edge is deterministic in both
embeddings of the skeleton, because by the property of triconnected graphs [48],
the set of edges incident to a vertex has a unique order around the vertex. By
lemma A.4 the code of the skeleton of an R-node is unique. If the R-node is ad-
jacent to leaf nodes µl(1) , . . . , µl(k) , the FIND CODE procedure (Algorithms 6
and 7) inserts the code of a leaf node whenever the virtual edge associated to
this leaf is encountered. The codes of µl(1) , . . . , µl(k) are unique and they are
inserted into the unique code of the skeleton of the R-node deterministically
when Euler’s tour encounters split pairs {s1 , t1 } . . . {sk , tk } associated with leaf
nodes (they identify how split components represented by leaves are adjacent to
the subgraph of G represented by the R-node), creating a unique representation
for the skeleton of the R-node and the leaves adjacent to this R-node in T .
Since we can build unique codes for nodes adjacent to leaves of T , by the
same reasoning we can build unique codes for any non-center node. The S-, P-,
and R- nodes with leaf codes associated with their virtual edges can become
new leaves in the SPQR-tree. Thus, we then have a new SPQR-tree containing
leaves with unique codes. Therefore we can continue to apply the above code
construction until reaching a center node.
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 350
e0=ein
s t
e1 k edges ek
e2
µl(1) µl(k)
(a)
Remainder of G
s t
e1 ek
(b)
Figure 12: (a) The skeleton of an S-node adjacent to leaves µl(1) , µl(2) , . . . , µl(k)
of an SPQR-tree and (b) split pairs {sl(1) , tl(1) }, . . . , {sl(k) , tl(k) } that splits G
into subgraphs with one-to-one correspondence to the skeletons of the leaves of
an SPQR-tree.
Center node.
In reference to the above discussion, a unique code exists for S-,P-,and R-nodes
if we can identify one initial edge of the skeleton. Let us find codes C1 , . . . , Ck
starting from all virtual edges of a central node in the same way as for non-
central nodes. All virtual edges are associated with unique codes of nodes
adjacent to the center. Because of the deterministic traversal of R- and S-
nodes, and parallel adjacency of split components to split pair vertices of a
P-node, codes C1 , . . . , Ck will be the same for isomorphic graphs and different
for non-isomorphic graphs. Choosing the smallest code Cmin from C1 , . . . , Ck
will uniquely identify the initial edge and from the discussion of non-root nodes,
Cmin will uniquely represent the center node and biconnected graph G. The
ambiguity associated with the two center nodes of T is resolved by applying
the procedure of finding a code from the center of T for every center node and
choosing the smaller code.
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 351
Next, we discuss the correctness of the algorithm of the unique code con-
struction for planar graphs. We show first that any biconnected tree has only
one center node. We use the unique code of biconnected graphs to show that
traversing a biconnected tree from the leaves towards the center allows for unique
code construction for planar graphs.
Lemma A.6 Any biconnected tree has only one center node.
Lemma A.7 The code produced by Algorithms 2-7 uniquely represents a con-
nected planar graph G.
Since the starting edge of G can be identified uniquely and P-, S-, and R- skele-
tons are traversed deterministically, the distance along traversed edges from the
initial edge of Gx to the articulation points is found without ambiguity. There-
fore, the code of vi and other articulation nodes of Gx are inserted into the
code of Gx uniquely identifying the positions of the articulation points in Gx .
The code of Gx , which includes codes of Gl , . . . , Gm uniquely identifies Gx and
Gl , . . . , Gm . The same reasoning we apply to all nodes of the biconnected tree
moving from the leaves to the center. By Lemma A.6, there is only one center
node of a biconnected tree. The code of the center node combines codes of all
biconnected subgraphs Gl , . . . , Gm and uniquely represents connected planar
graph G. 2
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 353
References
[1] Algorithms for graph drawing (AGD) User Manual Version 1.1.2. Technis-
che Universität Wien, Universität zu Köln, Universität Trier, Max-Planck-
Institut Saarbrücken, 2002.
[2] A. Aggarwal, M. Klawe, and P. Shor. Multi-layer grid embeddings for
VLSI. Algorithmica, 6:129–151, 1991.
[3] A. V. Aho, J. E. Hopcroft, and J. D. Ullmann. The Design and Analysis
of Computer Algorithms. Addison-Wesley, Reading, Mass., 1974.
[4] L. Babai and L. Kucera. Canonical labelling of graphs in linear average
time. In 20-th Annual Symp. Foundations of Computer Science, pages 39–
46, 1979.
[5] P. Bertolazzi, G. Di Battista, C. Mannino, and R. Tamassia. Optimal up-
ward planarity testing of single-source digraphs. SIAM Journal on Com-
puting, 27(1):132–168, 1998.
[6] T. Beyer, W. Jones, and S. Mitchell. Linear algorithms for isomorphism of
maximal outerplanar graphs. J. ACM, 26(4):603–610, Oct. 1979.
[7] K. Booth and G. Lueker. Testing for the consecutive ones property interval
graphs and graph planarity using PQ-tree algorithms. J. Comput. Syst.
Sci., 13:335–379, 1976.
[8] J. Boyer and W. Myrvold. Stop minding your P’s and Q’s: A simplified
O(n) planar embedding algorithm. In Proc. 10th Annu. ACM-SIAM Sym-
pos. Discrete Algorithms, pages 140–146, 1999.
[9] H. Bunke and G. Allermann. Inexact graph matching for structural pattern
recognition. Pattern Recognition Letters, 1(4):245–254, 1982.
[10] D. J. Cook and L. B. Holder. Substructure discovery using minimum de-
scription length and background knowledge. Journal of Artificial Intelli-
gence Research, 1:231–255, 1994.
[11] D. J. Cook and L. B. Holder. Graph-based data mining. IEEE Intelligent
Systems, 15(2):32–41, 2000.
[12] L. Cordella, P. Foggia, C. Sansone, and M. Vento. Performance evaluation
of the VF graph matching algorithm. In 10th International Conference on
Image Analysis and Processing, pages 1172–1178, September 1999.
[13] D. G. Corneil and C. C. Gotlieb. An efficient algorithm for graph isomor-
phism. J. Assoc. Comput. Mach., 17:51–64, 1970.
[14] A. Dessmark, A. Lingas, and A. Proskurowski. Faster algorithms for sub-
graph isomorphism of k -connected partial k -trees. Algorithmica, 27:337–
347, 2000.
J. Kukluk et al., Planar Graph Isomorphism, JGAA, 8(3) 313–356 (2004) 354
[22] H. Gazit and J. H. Reif. A randomized parallel algorithm for planar graph
isomorphism. In ACM Symposium on Parallel Algorithms and Architec-
tures, pages 210–219, 1990.
[23] H. Gazit and J. H. Reif. A randomized parallel algorithm for planar graph
isomorphism. Journal of Algorithms, 28(2):290–314, 1998.
[46] R. Tarjan. Depth-first search and linear graph algorithms. SIAM Journal
of Computing, 1(2):146–160, 1972.