Quantum Algorithms for Tree Isomorphism and State Symmetrization

# Quantum Algorithms for Tree Isomorphism and State Symmetrization

## Abstract

The graph isomorphism problem is theoretically interesting and also has many practical applications. The best known classical algorithms for graph isomorphism all run in time super-polynomial in the size of the graph in the worst case. An interesting open problem is whether quantum computers can solve the graph isomorphism problem in polynomial time. In this paper, an algorithm is shown which can decide if two rooted trees are isomorphic in polynomial time. Although this problem is easy to solve efficiently on a classical computer, the techniques developed may be useful as a basis for quantum algorithms for deciding isomorphism of more interesting types of graphs. The related problem of quantum state symmetrization is also studied. A polynomial time algorithm for the problem of symmetrizing a set of orthonormal states over an arbitrary permutation group is shown.

## 1Introduction

The problem of deciding if two graphs are isomorphic has many practical applications such as searching for an unknown molecule in a chemical database [1], verification of hierarchical circuits [2] and generating application specific instruction sets [3]. It is not known to be solvable in polynomial time on a classical computer despite a great deal of effort to develop an efficient algorithm. On the other hand, its -completeness would imply the collapse of the polynomial hierarchy to the second level [4]. Moreover, the complexity class that contains graph isomorphism [5] is similar to which contains the decision version of factoring — a problem that is solvable in quantum polynomial time using Shor’s algorithm [6]. This suggests that graph isomorphism is of intermediate complexity and may be solvable in polynomial time on quantum computers. This paper takes a step towards a polynomial time quantum algorithm for graph isomorphism based on the state symmetrization approach [7] by developing quantum algorithms for rooted tree isomorphism. By considering all possible roots in one of the trees, it is also possible to efficiently decide if two unrooted trees are isomorphic. Although tree isomorphism can be decided in linear time on a classical computer [8], the quantum algorithm for tree isomorphism shown in this paper relies on a different strategy which may be useful for solving graph isomorphism in cases that are not known to be solvable on classical computers in polynomial time. An algorithm is also presented for the related problem of symmetrizing a sequence of orthonormal states over an arbitrary permutation group.

## 2A quantum algorithm for tree isomorphism

One approach to the graph isomorphism problem is to prepare a superposition of all possible permutations of the adjacency matrix [7]. For a graph with automorphism group and adjacency matrix , this state is where denotes the adjacency matrix obtained by applying to . Given two graphs and , the states and are equal if and are isomorphic and are orthogonal otherwise. It can then be determined if and are isomorphic using the swap test [9]. However, this is not sufficient to solve graph isomorphism since no efficient algorithm is known for preparing the state . As a first step towards developing a general quantum algorithm for graph isomorphism using this approach, a quantum algorithm for tree isomorphism based on state symmetrization will be presented. The tree isomorphism algorithm operates on qudits with four computational basis states rather than qubits. These states are , , and . The states and are used in most parts of the algorithm for representing binary numbers and permutations while the other computational basis states have special purposes. The state is used to mark the beginning of a tree while marks the end of a tree as in the classical tree isomorphism algorithm. The algorithm works by preparing a state for a given rooted tree such that given two rooted trees and , if and are of the same dimension then if and only if and if and only if . If and are not of the same dimension then it is required that . Such states can be prepared recursively as follows. Consider a rooted tree . If consists of a single node (for instance if is a leaf node in a larger tree), then let . Otherwise, let denote the subtrees rooted at the children of the root node of . For each , let denote the unitary matrix such that . Note that the states and are not necessarily of the same dimension for as there are bijections between the number of qudits in , the dimension of and the number of nodes in the tree . Let denote the number of qudits in the state . Observe that (assuming the algorithm works properly on smaller trees) or if while and if . Now construct the state

where each register contains qudits and each register contains qudits where is the largest branching factor that occurs in the entire tree. Let be the number of subtrees such that where is the number of nodes in . Now execute algorithm ? to obtain the state

where is the number of subtrees with that are isomorphic to .

Now append a new set of registers initialized to yielding the state

where each register uses qudits. XOR the contents of each register into the register obtaining the state

Letting results in the state

where each register contains registers and . Now, prepare the state (the uniform superposition over all permutations in ) in another register to obtain

Apply a conditional permutation which permutes the order of the registers resulting in the state

Note that since the registers now contain different numbers of qudits for different terms in the quantum superposition, special care must be taken here. Each is represented as a product where each and the permutation is stored as where when . The next step is to uncompute the contents of the register. Each vector corresponds to a unique permutation because each is orthogonal to every for . Note that might be isomorphic to for some but in this case so that and will still be orthogonal. This was the reason for labeling each register with the number of isomorphic subtrees in the sequence . Add another set of registers initialized to obtaining the state

where each register uses qudits. Now XOR the contents of register with resulting in the state

Apply a conditional permutation to reorder the registers according to the contents of register obtaining the state

Now, note that each is represented in subgroup tower form as a product where each . Then the contents of register can be uncomputed using the procedure (to be described later) for converting the row representation of to the subgroup tower representation for . This results in the state

after discarding the contents of register which is now . The next step is to uncompute each register. To do this, first add a new register initialized to yielding the state

where the register uses one qudit. The contents of the registers are then uncomputed using algorithm ?. This results in the state

after discarding the contents of the and registers which are now all in the state .

It is now necessary to uncompute the contents of the registers. First add a new set of registers initialized to yielding the state

where each register uses qudits. Initialize the contents of each register where to by applying to each register where . This results in the state

where if and if . The contents of the registeres are then uncomputed by applying the inverse of algorithm ? which was used to set each register to in the first place. This yields the state

after the registers which are now all equal to are discarded. Uncomputing the contents of the registers is accomplished by applying to each register where . Discarding the registers then results in the state

Prepending a and appending a to this state yields the final state

Given two rooted trees and , the states and as defined in the above equation have the property that if and are of the same dimension then if and only if and if and only if as desired.

## 3Complexity analysis of the tree isomorphism algorithm

In this section, it will be shown that the quantum tree isomorphism algorithm presented in Section 2 is polynomial. To do this, the first step is to create a recurrence for the running time of the algorithm. This results in

where

and

is the number of qudits required for the state where is a tree containing nodes. Each denotes the multiplicity with which occurs in the values as in the description of the algorithm. The functions describe the complexities of different subroutines of the algorithm and are bounded above by polynomials. The recurrence is bounded above by the recurrence

where

and is bounded above by some polynomial. It will now be shown that is polynomial in . Consider . There exist and with and such that . Let be a subset of such that for each , there exists such that and if then . Thus, for each distinct value of , contains exactly one index such that . The analysis is performed using . Consider the following three cases:

• Suppose that for some with . One of the subtrees with only one node will now be removed to obtain a lower bound for . Let

Then a lower bound for is

Therefore,

• Consider the case where for some . A lower bound for is now obtained by removing one node from the subtree containing nodes. Let

and let denote the multiplicity with which occurs in the values . Then a lower bound for is

Thus,

• For the final case, suppose that and for all . Choose the smallest such that . A lower bound for will be obtained by reducing each such that by one. Let

Then a lower bound for is

Hence,

A recurrence can now be defined in terms of maximum of the upper bounds obtained in each case so that

Let

where

and is a polynomial upper bound for . Also, note is a value which depends on . It will now be shown that for all and for all with appropriately chosen constants , and . Let and denote the degrees of in and respectively. Let and . Since , . This implies that by choosing a constant which depends only on the coefficients of and the constants and , the following properties can be satisfied:

• for all and for all

• for all and for all

It can then be shown that for all and for all by induction. Note that the basis case is satisfied by the choice of . For the inductive case, assume that for . Now consider . By choice of , so

By assumption, so for , . Thus,

Recall that in the expression for , . Therefore, for with ,

Thus, so

Consequently,

which proves that

for all and for all . Hence,

so is polynomial in .

## 4Subroutines for the tree isomorphism algorithm

To finish describing the algorithm, all that remains is to show how to implement the three subroutines it utilizes. These are preparing the uniform superposition over all permutations, applying a conditional permutation and converting the row form of the inverse of a permutation to the subgroup tower form if .

### 4.1Preparing the uniform superposition over all permutations

This state can be prepared for using basic operations using generator state based algorithms for initialization [10]. It is actually possibly to do this more efficiently but this is not necessary for the purposes of this algorithm as it will result in the same complexity.

### 4.2Implementing conditional permutations

Since this operation is a bijection which takes an input of fixed length that can be implemented in polynomial time on a classical computer it can also be implemented in polynomial time on a quantum computer.

### 4.3Converting permutations from row form to subgroup tower form

This section will show how to convert a permutation in row form

to the subgroup tower form . First, observe that so the equation

allows to be decomposed into the product of one of the transpositions in the set and an element of . The conversion procedure works by repeating this decomposition. Append a second set of registers initialized to resulting in the state

where the register contains qudits. Now execute algorithm ?. This results in the state

where is the subgroup tower form of . Discarding the registers yields

which is the subgroup tower form of . Now the algorithm actually requires a procedure that will convert the row form

of to the subgroup tower form of . To do this it suffices to show how to invert the row form

of . This can be done by first appending new registers each in the state . This results in the state

where each register contains qudits. Then apply algorithm ?. This results in the state

Applying algorithm ? again with the roles of the registers and swapped uncomputes the contents of the registers. This yields the state

which results in the row form

after discarding the registers . The cost of this procedure is basic operations.

## 5Quantum algorithms for state symmetrization

In this section, the problem of quantum state symmetrization which is closely related to graph isomorphism will be studied. Let be a sequence of orthonormal states and let be a subgroup of . The problem is to prepare the state