spectral graph isomorphism - university of...

22
Spectral Graph Isomorphism Alexandra Kolla 1 , Yannis Koutis 2 , Vivek Madan 1 , and Ali Kemal Sinop *1 1 Department of Computer Science, University of Illinois, Urbana-Champaign 2 Computer Science Department, University of Puerto Rico, Rio Piedras July 11, 2017 Abstract In this paper, we initiate the study of spectral generalizations of Graph Isomorphism. We define two main problems. 1. The spectral graph isomorphism (SGI) problem: given two graphs G and H as input, does there exist a permutation π such that G and π(H) are spectrally close? This is a mathematical formulation of certain problems in shape and image matching, and is also a natural extension of the fundamental problem of graph isomorphism and its variations. 2. The graph dominance (GD) problem: given two graphs G and H as input, does there exist a permutation π such that π(H) is spectrally dominated by G? In this paper, we present the first (to our knowledge) algorithmic and hardness results on SGI and GD respectively. Our two main results are: a polynomial time algorithm that finds a nearly-optimal spectral isomorphism when the input graphs are bounded degree trees and an NP-hardness result for the GD problem and APX-hardness for optimization version of GD problem. 1 Introduction Given two symmetric positive semi-definite n by n matrices A and B with the same kernel, their relative condition number κ(A, B) is defined to be the ratio of the largest to the smallest eigenvalue of AB , where denotes pseudo-inverse (see e.g. [22] for defn). It follows from the definition that κ(A, B) is the minimum positive number such that for all x ∈R n : 1 κ(A, B) x T Ax x T Bx κ(A, B). (1) When A and B are the Laplacian matrices of graphs G and H respectively, we say that G and H are α-spectrally close if the condition number, κ(A, B) is α. We say that -dominates A if for all x ∈R n we have: x T Ax x T Bx 1. * {akolla,vmadan2}@illinois.edu, [email protected], [email protected]. Part of this work was supported by NSF grant CCF-1319376.

Upload: others

Post on 10-Mar-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Spectral Graph Isomorphism - University Of Illinoisvmadan2.web.engr.illinois.edu/papers/spectral...In particular, SGI is a natural approximation version of the well-known graph isomorphism

Spectral Graph Isomorphism

Alexandra Kolla1, Yannis Koutis2, Vivek Madan1, and Ali Kemal Sinop∗1

1Department of Computer Science, University of Illinois, Urbana-Champaign2Computer Science Department, University of Puerto Rico, Rio Piedras

July 11, 2017

Abstract

In this paper, we initiate the study of spectral generalizations of Graph Isomorphism. We definetwo main problems.

1. The spectral graph isomorphism (SGI) problem: given two graphs G and H as input, doesthere exist a permutation π such that G and π(H) are spectrally close? This is a mathematicalformulation of certain problems in shape and image matching, and is also a natural extensionof the fundamental problem of graph isomorphism and its variations.

2. The graph dominance (GD) problem: given two graphs G and H as input, does there exist apermutation π such that π(H) is spectrally dominated by G?

In this paper, we present the first (to our knowledge) algorithmic and hardness results on SGI andGD respectively. Our two main results are: a polynomial time algorithm that finds a nearly-optimalspectral isomorphism when the input graphs are bounded degree trees and an NP-hardness resultfor the GD problem and APX-hardness for optimization version of GD problem.

1 Introduction

Given two symmetric positive semi-definite n by n matrices A and B with the same kernel, theirrelative condition number κ(A,B) is defined to be the ratio of the largest to the smallest eigenvalueof AB†, where † denotes pseudo-inverse (see e.g. [22] for defn). It follows from the definition thatκ(A,B) is the minimum positive number such that for all x ∈ Rn:

1

κ(A,B)≤ xTAx

xTBx≤ κ(A,B). (1)

When A and B are the Laplacian matrices of graphs G and H respectively, we say that G and Hare α-spectrally close if the condition number, κ(A,B) is α. We say that B α-dominates A if for allx ∈ Rn we have:

xTAx

xTBx≤ 1/α

.

∗{akolla,vmadan2}@illinois.edu, [email protected], [email protected]. Part of this work was supportedby NSF grant CCF-1319376.

Page 2: Spectral Graph Isomorphism - University Of Illinoisvmadan2.web.engr.illinois.edu/papers/spectral...In particular, SGI is a natural approximation version of the well-known graph isomorphism

In this paper we initiate the study of spectral versions of the notorious graph isomorphism prob-lem. We introduce the spectral graph isomorphism (SGI): Given two graphs G,H on n nodes, find apermutation π such that, for all x ∈ Rn:

1

α≤ xTLGx

xTLπ(H)x≤ α

If such permutation exists, we say that G and H are α-spectrally isomorphic.

We also consider a one-sided version of SGI, namely the graph dominance (GD) problem: giventwo graphs G and H as input, find a permutation π such that, for all x ∈ Rn: xTLπ(H)x ≤ xTLGxor, equivalently, Lπ(H) � LG (where � denotes PSD order).

We find the spectral graph isomorphism and graph dominance problems theoretically interestingdue to their close relationship to other fundamental algorithmic questions. In particular, SGI is anatural approximation version of the well-known graph isomorphism problem [12, 8, 16, 1], which iseasily seen to be equivalent to SGI when α = 1. It can also be seen as the spectral analog of robustgraph isomorphism [18]: On an input of two graphs which are almost isomorphic in the sense that theyonly differ in a small amount of edges, find an“almost-isomorphism”. Moreover, for the special case ofSGI, where both of the input graphs G and H are restricted to be trees, the spectral graph isomorphismproblem can be viewed as a natural generalization of the minimum distortion (MD) problem, whichwas introduced in [6]: On an input of two n-point metric spaces, find a bijection between them withminimum distortion. This connection between SGI and MD stems from the observation that if two treegraphs G and H are α-spectrally isomorphic, then the distortion between the induced graph distancesof G and π(H) is at most α. In view of the vast number of works on GI ([12, 8, 24, 21, 4, 16, 1] tomention a few) as well as the works on the robust graph isomorphism problem [18] and the minimumdistortion problem [6], we find it surprising that our problem has not been studied before.

Moreover, the GD problem can also be seen as a one-sided version of graph isomorphism: twographs G and H are isomorphic if and only if LG � Lπ(H) and Lπ(H) � LG for some π. GD asks fordominance from one-side.

Part of the appeal of spectral graph isomorphism, in contrast to graph isomorphism, is that itcaptures the fact that even if two graphs G and H look very different combinatorially, the graphsmight be close under some appropriate metric. If that is the case, then H can be used as a proxyfor G in computations without introducing too much error. This makes our problem appealing to avariety of practical applications. We believe that SGI might have large impact in computer vision,graphics, and machine learning, and in particular to shape matching and object recognition. Therehave been a series of works on the use of graph spectra for shape matching and retrieval in computervision [20, 23] and geometry processing [13, 17]. Eigenvalues of graphs are closely related to almost allmajor graph invariants and serve as compact global shape descriptors and establish a correspondencefor computing the similarity distance between two shapes. Thus if a matrix models the structures of ashape, either in terms of topology or geometry, then we would expect its set of eigenvalues (spectrum)to provide an adequate characterization of the shape. So we believe that our problem of spectralgraph isomorphism is a natural fit for these approaches. Let’s look at the examples of identifyinga hand-written number (or any given shape) by comparing it with a set of stored prototype shapesor matching of facial features. We propose the following approach which uses our spectral graphisomorphism problem: The input shape as well as the prototype shapes will first be modeled by agraph in some canonical fashion e.g. [15, 2] 1. Subsequently, one will look for a spectral isomorphismbetween the given graph and graphs that model the prototype shapes. Since the spectrum of graphs

1Typical feature-based approaches to these applications first use an edge detector to extract a shapes silhouette orcontours, and then represent the shape by a sample of points on the detected curve(s) [2]. More concretely, the input

2

Page 3: Spectral Graph Isomorphism - University Of Illinoisvmadan2.web.engr.illinois.edu/papers/spectral...In particular, SGI is a natural approximation version of the well-known graph isomorphism

provides an adequate characterization of the shape, we would match the input shape to a prototypeshape to which the input shape is spectrally closest to. We believe that spectral graph isomorphismcan also be used in more sophisticated techniques presented in [20, 23, 13, 17].

Our goal in this paper is twofold; to prove some initial results about the spectral graph isomorphism,and the graph dominance problem, as well as to stimulate further work on the area. Towards thatend, we make the following formal definitions:

Graph-Dominance: Given two graphs G,H, does there exists a permutation π on V (G) suchthat LH � Lπ(G)?

Condition-Number: Given two graphs G(V,EG) and H(V,EH), find a permutation π of V soas to minimize κ(LG, Lπ(H)).

Our first result is a hardness result for the graph dominance problem:

Theorem 1.1. The Graph-Dominance problem is NP-hard, even if both the input graphs arebounded degree and one the input graphs is a tree.

Moreover, our proof shows that there exists a constant δ > 0 such that it is also NP-hard todistinguish between the case when there exists π such that Lπ(H) � LG or there is no π such thatLπ(H) � (1 + δ)LG. Hence, the optimization version of Graph-Dominance is NP-hard.

We note that, interestingly, the “two sided” version of Graph-Dominance, which is equiva-lent to graph isomorphism, is no longer NP-hard [1]. Motivated by the hardness result of Graph-Dominance, even when one of the graphs is a bounded degree tree, we next consider the spectralgraph isomorphism problem in the case where the two input graphs are bounded degree trees.

Our second result is an algorithm which approximates Condition-Number within a quadraticfactor when both of the input graphs are trees of bounded degree.

Theorem 1.2. Given two trees G and H with relative condition number (after permutation of thevertices of one graph) k and maximum degree d, there exists an algorithm running in time O(nO(k2d))which finds a mapping certifying that the condition number is at most k2.

This special case of SGI when the input graphs are trees is independently of both theoretical andpractical interest. On the theoretical side, we observe that the results in [6] imply that the followingproblem, which is closely related to SGI, is NP-hard even if one of the input graphs is a tree:

Cuts-and-Distances: (Informal Statement) Given two graphs G(V,EG) and H(V,EH), find apermutation π of V which approximates both the cuts and the distances between G and π(H). For aformal definition of Cuts-and-Distances, see Section 2.

Interestingly, Cuts-and-Distances is the problem we solve in order to design our spectral graphisomorphism algorithm stated in Theorem 1.2. This reduction suggests that SGI might be computa-tionally harder than graph isomorphism, since it is known that there exists a quasi-polynomial timealgorithm for GI ([1]). Moreover, even though there is a simple, polynomial time algorithm for graphisomorphism when the input graphs are trees [3]; our hardness result suggests that spectral graph

to these applications is modeled as some appropriate mesh. A matrix M which represents a discrete linear operatorbased on the structure of the input mesh is constructed, typically as a discretization of some continuous operator. Thismatrix can be seen as incorporating pairwise relations between mesh elements and it typically corresponds to the graphadjacency or Laplacian operator of a relevant graph.

3

Page 4: Spectral Graph Isomorphism - University Of Illinoisvmadan2.web.engr.illinois.edu/papers/spectral...In particular, SGI is a natural approximation version of the well-known graph isomorphism

isomorphism is likely to be hard even in the case where at least one of the the input graphs is a tree,similarly to the case for Graph-Dominance.

On the practical side, in several instances of the image recognition and shape matching problemsmentioned above, the resulting graph which models the input shape is a tree graph. For instance,medial-axis based structures such as the shock graph [10] and skeletons of certain objects [14] are alltree graphs. Our algorithm for spectral graph isomorphism on trees is a good algorithmic fit for thoseapplications.

Related Work. To the best of our knowledge, the spectral graph isomorphism and graph dominanceproblems has not been addressed before. Here we briefly survey previous work on related problems.

Graph isomorphism is a well studied problem [16, 12, 8, 24, 21] and it was recently shown in abreakthrough paper of Laszlo Babai that the exact problem can be solved in quasi-polynomial time.

Two weaker notions of graph isomorphism were considered before. In the first one, the goal is tominimize the number of mismatched edges. For this version, O’Donnell et al. [18] gave a constantfactor hardness. In the second version, the graph is treated as a distance metric (using the shortestpath distance) and one tries to find a mapping between two metrics so as to minimize the maximumdistortion. For this case, Kenyon et al. [6] gave an algorithm which finds a solution with distortion atmost α (provided that it exists) in time poly(n) exp(dO(α3)), where d is the maximum degree of thegraphs. They also prove that this problem is NP-hard to approximate within a factor of 4

3 .

The use of condition number, i.e. the ratio of Rayleigh quotients of associated Laplacian matrices,to measure the similarity of graphs can be traced back to preconditioning which is prevalent in linearsystem solvers and scientific computing [9]. In a nutshell, the goal of preconditioners is to approximateone graph with another much simpler graph such that the condition number is small. To the best ofour knowledge, algorithmically testing whether two graphs are spectrally close to each other have notbeen considered before in the literature.

1.1 Our Techniques

In this section, we briefly describe our main ideas for the two results claimed above.

Hardness for Graph-Dominance. We prove that Graph-Dominance is NP-hard by reducingfrom a known NP-hard problem, Hamiltonian Cycle in the cubic subgrid graphs. Papadimitriouand Vazirani [19] showed that finding hamiltonian cycle in a subgrid graph is NP-hard even if thedegrees of all the vertices is bounded by 3. We set H to be the cycle of length n and show that if Gis a cubic subgrid graph, then there exists π satisfying Lπ(H) � LG iff G contains a hamiltonian cycle.The proof can also be modified by deleting one edge from G and H so that two new graphs are cubicsubgrid and a path. This shows NP-hardness of Graph-Dominance problem even if H is a path andG is a cubic graph.

If G contains a hamiltonian cycle, then there is a permutation π such that π(H) is a subgraph of G.Hence, Lπ(H) � LG. To prove the converse, assume that G does not contain a hamiltonian cycle. We

prove that for any permutation π, there exists x such that xTLπ(H)x > xTLGx. We start by assumingthat π is an identity permutation; otherwise, we can consider the permuted graph G. If G′ and H ′ arethe graphs obtained by deleting shared edges between G and H, then it is sufficient to find a vectorx such that xTLG′x > xTLH′x to show that xTLGx > xTLHx. If in the resulting graphs G′, H ′,there exists a vertex v with degG′(v) = 1 and degH′(v) ≥ 1, then the resistance between the u and vsuch that (u, v) ∈ E′H is lower in G′ than in H ′. Hence, there exists x such that xTLH′x > xTLG′x.

4

Page 5: Spectral Graph Isomorphism - University Of Illinoisvmadan2.web.engr.illinois.edu/papers/spectral...In particular, SGI is a natural approximation version of the well-known graph isomorphism

And if there exists a vertex v with degG′(v) = 1, degH′(v) = 0, then we can simply ignore the edgeincident to v. Next, we show that if there exists a set S such that number of edges going out of Sin H ′ is more than in G′, then the cut vector x shows xTLH′x > xTLG′x. Along with few additionalcases, these steps helps us construct a vector x such that xTLG′x < xTLH′x which in turn shows thatxTLGx < xTLHx. Hence, H is not spectrally dominated by the graph G if G does not contain ahamiltonian cycle.

Algorithm Overview for SGI. We will now describe our main technical contributions and providean overview of our algorithm for SGI. By substituting appropriate vectors x in the definition ofcondition number (1), we can easily see that if two graphs G and H are α-spectrally isomorphic under

some permutation π so that 1α ≤

xTLGxxTLπ(H)x

≤ α, then π also preserves the cuts and effective resistances

between graphs G and H as well. Namely, if δG(S) and δH(π(S)) are two corresponding cuts in Gand H, and RG(u, v), RH(π(u), π(v)) are the effective resistances between two corresponding pairs ofvertices in G and H, then:

1

α≤ δG(S)

δH(π(S))≤ α (2)

and1

α≤ RG(u, v)

RH(π(u), π(v))≤ α. (3)

Our first contribution in this paper is to show that in the case where G and H are trees, theseconditions are also sufficient for G and H to be spectrally isomorphic. Namely, if

1

α≤ δG(S)

δH(π(S))≤ α

and1

β≤ RG(u, v)

RH(π(u), π(v))≤ β,

then1

α · β≤ xTLGx

xTLπ(H)x≤ α · β.

One useful property of the trees is that, the effective resistance is equal to the distance. This meanswe can replace (3) with the following, arguably more useful condition:

1

β≤ dG(u, v)

dH(π(u), π(v))≤ β. (4)

Here dG, dH are the induced graph distances on graphs G and H, respectively.

Remark 1.3. The above implication 2 does not hold for general graphs. In Appendix A, we exhibittwo graphs G and H for which cuts are within a constant factor and effective resistances are within afactor of O(log n) of each other, yet the condition number is at least

√n.

Our task of finding a spectral isomorphism now gets reduced to finding a permutation such thatboth the cuts and distances are similar between the two graphs. In order to search for the optimalpermutation among n! many possible permutations, we use a rather complicated dynamic programming

2Namely that if there is a permutation π such that both the cuts and effective resistances are similar between G andπ(H) then G and H are also α-spectrally isomorphic, for some α that depends quadratically on how close are the cutsand effective resistances between the two graphs.

5

Page 6: Spectral Graph Isomorphism - University Of Illinoisvmadan2.web.engr.illinois.edu/papers/spectral...In particular, SGI is a natural approximation version of the well-known graph isomorphism

argument. We first fix some arbitrary node in G to be the root and guess the corresponding nodein H. Next we order the nodes of G with respect to their height. Starting with the bottom layer ofleaves, we maintain a set of “good” partial permutations, which are maps of the corresponding subtreeinto the nodes of H while preserving cuts and distances. Unfortunately, naively keeping track of allsuch partial permutations and trying to aggregate them as we move further up in the tree will notwork due to the simple fact that number of permutations might grow exponentially. Furthermore, theimage of current subtree of G we are looking at, in H need not be a subtree itself – it might very wellmap to an independent set in H!

In order to resolve this issue, we augment our partial mappings to keep track of the mapping ofadditional nodes from H to G, which we call “critical sets”. To put it simply, the critical set of asubset correspond to the set of (both) endpoints of edges crossing that subset. However this idea facessome immediate challenges:

(a) Permutations found for different subtrees may not match along their critical sets.

(b) The number of choices for critical sets might be too large.

A simple approach for resolving (b) would be to show that the size of critical sets is small, which iscommon in usual dynamic programming situations. Unfortunately in our case we cannot bound thesize of the critical sets of vertices. In order to resolve the issues above, we show that, even though wecannot bound the size of the critical sets of vertices, we can still bound the number of choices for thecritical sets by O(nk

2) where k is the condition number. This lets us get around the difficulty from (b).

Additionally, we prove that for any subtree, there exists a set S of polynomially many permutationssuch that, for any valid permutation π of the subtree, one of the permutations in S agrees with π onthe critical sets of vertices; thus resolving challenge (a). Hence, for each subtree we only need to storepolynomially many valid permutations, which allows us to run our algorithm in polynomial time.

1.2 Paper Organization

The paper is organized as follows. In Section 2 we present some notation and definitions we will usethroughout the paper. Section 3 contains the NP-hardness proof for Graph-Dominance. Section 4contains our main algorithmic result, and is divided into two subsections. In Section 4.1 we showthat in order to find a spectral graph isomorphism between two tree graphs, it is sufficient to find apermutation under which both the cuts and distances are similar between the two trees. In Section 4.2we present our main algorithm, thus proving Theorem 1.2. Finally we explore some open problemsand future directions in Section 5.

2 Preliminaries

In this section, we will introduce notation and terminology that we will use throughout this paper.We focus on unweighted, undirected, simple graphs of the form G = (V,E) where V, n = |V | is the setof nodes and E is the set of edges. We denote the edges crossing a cut S, V − S in G by δG(S). Weomit the subscript if it is clear from the context. We use dH to denote the induced graph distance.

Laplacian Matrix. Given an unweighted, undirected graph G = (V,E); its Laplacian matrix, L, isdefined as the symmetric matrix, whose rows and columns correspond to V , such that for any nodeu ∈ V : Lu,u is equal to the degree of u and for any edge {u, v} ∈ E: Lu,v = −1. One useful property

6

Page 7: Spectral Graph Isomorphism - University Of Illinoisvmadan2.web.engr.illinois.edu/papers/spectral...In particular, SGI is a natural approximation version of the well-known graph isomorphism

of Laplacian matrices is that, for any vector x:

xTLx =∑{u,v}∈E

(xu − xv)2. (5)

From this definition, one can easily see that the kernel of L is spanned by the indicator vectorscorresponding to the connected components of G. In particular, if G is a connected graph, then thekernel of L is all constant vectors.

Positive Semidefinite Ordering. Given a pair of symmetric matrices, A and B; we say thatA � B whenever xTAx ≥ xTBx for all vectors x. We say that A is a positive semidefinite (PSD)matrix if A � 0.

Condition Number. Given two PSD matrices A,B � 0 with the same kernels; we define theircondition number κ(A,B) to be the smallest number κ for which κA � B and κB � A. Since both Aand B are PSD, this definition ends up being equivalent to the following:

κ = maxx

{xTAx

xTBx,xTBx

xTAx

∣∣∣∣∣Ax 6= 0

}. (6)

For PSD matrices, we may also use the pseduoinverses of A and B in eq. (6):

Lemma 2.1. For any A,B � 0 with ker(A) = ker(B); κ(A,B) = κ(A†, B†) where A† and B† are thepseudoinverses of A and B, respectively.

Proof. First observe that B � A � 0 then B† � A† [11]. Suppose κ(A,B) = κ. Then κA � B, whichimplies that (κA)† = 1

κA† � B† ⇐⇒ A† � κB†. Similarly κB � A implies 1

κB† � A†, which is

equivalent to B† � κA†. Therefore κ(A†, B†) = κ.

Condition Number of Graphs. Given a pair of graphs with the same connected components,G and H, we define the condition number of G and H as the condition number of their Laplacianmatrices, L and M : κ(G,H) , κ(L,M).

One might think of the condition number as a measure of how similar two graphs are in terms oftheir global properties, such as cuts, commute times and so on.

Cut Distortion and Distance Distortion. Given two graphs G(V,EG) and H(V,EH), we definetheir cut distortion κcuts(G,H) to be the smallest number α for which:

1

α≤ δG(S)

δH(S)≤ α. (7)

We define their distance distortion κdistances(G,H) to be the smallest number β such that:

1

β≤ dG(u, v)

dH(u, v)≤ β. (8)

We also define the following computational problem, which is of the same flavor as spectral graphisomorphism:

Cuts-and-Distances: Given two graphs G(V,EG) and H(V,EH) such that there exists a per-mutation π of V such that κcuts(G, π(H)) ≤ α and κdistances(G, π(H)) ≤ β, find a permutation π′

(possibly different than π), which satisfies κcuts(G, π′(H)) ≤ α and κdistances(G, π

′(H)) ≤ β.

7

Page 8: Spectral Graph Isomorphism - University Of Illinoisvmadan2.web.engr.illinois.edu/papers/spectral...In particular, SGI is a natural approximation version of the well-known graph isomorphism

3 Graph Dominance

Problem Definition(Graph-Dominance): Given two graphs G,H, does there exists a permutationπ on V (G) such that Lπ(H) � LG.

Here, we prove Theorem 1.1 which states that Graph-Dominance is NP-hard even when H is abounded degree tree and G is a bounded degree graph. We prove it by reducing from the problem offinding Hamiltonian Cycle in cubic subgrid.

Hamiltonian Cycle in cubic subgrids:(HCG) Let G∞ be the infinite graph consisting of allpoints of the plane with integer coordinates and edges connecting points with Euclidean distance one.A cubic subgrid is a finite subgraph of G∞ such that all nodes have degree at most 3. Papadimitriouand Vazirani [19] proved that finding hamiltonian cycle in a cubic subgrid graph is NP-hard.

Theorem 3.1. Let H be a cycle on n vertices and G be a cubic subgrid graph on n vertices. Then,there exists a permutation π s.t. Lπ(H) ≤ LG iff G contains a hamiltonian cycle.

Proof. Suppose G contains a hamiltonian cycle. Then, there exists a permutation π such that π(H) isa subgraph of G. For any vector x, xTLπ(H)x =

∑(u,v)∈EH (xu − xv)2, xTLGx =

∑(u,v)∈EG(xu − xv)2.

Since, EH ⊂ EG, we have xTLπ(H)x ≤ xTLGx for all vectors x ∈ Rn. Hence, Lπ(H) � LG. To provethe converse, consider a graph G on n vertices which does not contain a hamiltonian cycle. We willprove that for any permutation π, we can find a vector x such that xTLHx > xTLGx. Without lossof generality, we assume that π is an identity permutation. Otherwise, we can simply consider thepermuted graph G.

Claim 1. Let G′, H ′ be the graph obtained by deleting common between G and H. Then, xTLG′x <xTLH′x iff xTLGx < xTLHx.

Proof. Let F = EG ∩ EH . xTLGx =∑

(u,v)∈EG\F (xu − xv)2 +

∑(u,v)∈F (xu − xv)

2 = xTLG′x +∑(u,v)∈F (xu − xv)2. Similarly, xTLHx = xTLH′x +

∑(u,v)∈F (xu − xv)2. Hence, xTLGx < xTLHx iff

xTLG′x < xTLH′x.

So, from now on we wil work with the graph G′ and H ′ and construct a vector x such thatxTLH′x > xTLG′x.

Claim 2. Let there be a vertex v with degG′(v) = 1, degH′(v) = 0 and G′′ be the graph obtained afterdeleting the edge incident to v. Then, there exists a vector x s.t. xTLG′x < xTLH′x iff there exists ys.t. yTLG′′y < yTLH′y

Proof. Let x be a vector such that xTLG′x < xTLH′x. Since G′′ is a subgraph of G′, we havexTLG′′x ≤ xTLG′x < xTLH′x. To prove the converse, lets assume that yTLG′′y < yTLH′y and theedge incident to v in G′ be (v, w). Define x as follows: xu = yu for all u 6= v and xv = yw. Since,degH′(v) = 0, we have yTLH′y = xTLH′x. G′ and G′′ agree on all the edges except (v, w). Hence,xTLG′x = xTLG′′x + (xv − xw)2 = xTLG′′x. x and y agree on all the entries except at v and degreeof v in G′′ is zero. Hence, xTLG′′x = yTLG′′y. Combining all the inequalities we get,

xTLG′x = xTLG′′x = yTLG′′y < yTLH′y = xTLH′x

8

Page 9: Spectral Graph Isomorphism - University Of Illinoisvmadan2.web.engr.illinois.edu/papers/spectral...In particular, SGI is a natural approximation version of the well-known graph isomorphism

Claim 3. Let G′ and H ′ be the graph obtained by deleting the shared edges between G and H and thenrecursively deleting edges (u, v) if degG′(u) = 1 and degH′(u) = 0. Then, for any vertex u, degG′(u) ≤degH′(u) + 1.

Proof. Since, G is a cubic subgrid graph and H is a cycle, degG(u) ≤ 3, degH(u) = 2 for all vertices u.Deleting edges shared between G and H decreases the degree of vertex by same amount in G and H.And recursively, we only delete edges from G′. Hence, degG′(u) ≤ degH′(u) + 1.

Claim 4. If there exists a vertex v s.t. degG′(v) = 1, degH′(v) ≥ 1. Then, there exists a vector x s.t.xTLG′x < xTLH′x.

Proof. Let the edge incident to v in G′ be (v, w) and an edge incident to v in H ′ be (v, u). Since, H ′ andG′ do not share any edge, we have u 6= w. Let x ∈ Rn be a vector defined as follows: xv = 0, xw = 1

2and for all t 6= v, w, xt = 1.

xTLH′x =∑

(a,b)∈EH′

(xa − xb)2 ≥ (xv − xu)2 = 1

xTLG′x =∑

(a,b)∈EG′

(xa − xb)2 = (xv − xu)2 +∑

(w,a)∈E′G,a 6=v

(xw − xa)2

w has at most two neighbors other than v since, degG′(v) ≤ 3 and for any such neighbor (xa−xw)2 =(12 − 1)2.

xTLG′x ≤ (0− 1

2)2 + 2(

1

2− 1)2 = 3/4

Hence, we get xTLH′x < xTLG′x.

If there exists a vertex with degree 1 in G′ with degree 0 in H ′, then we can delete the edge andproceed and if there exists a vertex with degree 1 in G′ and at least 1 in H ′, we already found thevector x such that xTLG′x < xTLH′x. From now on, we will assume that there is no degree one vertexin G′ and for all vertices u, degG′(u) ≤ degH′(u) + 1. For convinience, from time to time we will referto the edges of G′ as black edges and edges of H ′ as blue edges.

Lemma 3.2. If there exists five vertices u, v, w1, w2, w3 such that

• (u,w1), (w1, w2), (w2, w3) are black edges and (v, w1), (v, w2) are not black edges.

• (u, v) is a blue edge and (u,w2) is not a blue edge.

Then, there exists a vector x such that xTLH′x > xTLG′x

Proof. Let x be a vector such that xu = 0, xv = 2, xw1 = 13 , xw2 = 2

3 and for w 6= u, v, w1, w2, xw = 1.

xTLH′x =∑

(a,b)∈EH′

(xa − xb)2

≥ (xu − xv)2 +∑

(u,a)∈EH′ ,a 6=v

(xu − xa)2 +∑

(v,b)∈EH′ ,b 6=u

(xv − xb)2

= 4 + (degH′(u)− 1) · 1 + (degH′(v)− 1) · 1= degH′(u) + degH′(v) + 2 ≥ degG′(u) + degG′(v) (Claim 3)

9

Page 10: Spectral Graph Isomorphism - University Of Illinoisvmadan2.web.engr.illinois.edu/papers/spectral...In particular, SGI is a natural approximation version of the well-known graph isomorphism

xTLG′x =∑

(a,b)∈EG′

(xa − xb)2

= (xu − xw1)2 + (xw1 − xw2)2 + (xw2 − xw3)2 +∑

(u,a)∈EG′ ,a6=w1

(xu − xa)2 +∑

(v,b)∈EG′

(xv − xb)2

+∑

(w1,c)∈EG′ ,c 6=w2,u

(xw1 − xc)2 +∑

(w2,d)∈EG′ ,d6=w1,w3

(xw1 − xd)2

Since, w1 is not incident to v, (xw1 − xc)2 = (13 − 1)2. Since, in a subgrid graph there is no cycleof length 3, w2 is not incident to u. Also, w2 is not incident to v from the assumption in the lemma.Hence, (xw2 − xd)2 = (23 − 1)2. Since, all vertices of G′ have degree at most 3, |{c | (w1, c) ∈ EG′ , c 6=w2, u}|, {d | (w2, d) ∈ EG′ , d 6= w1, w3}| ≤ 1. Since, G′ and H ′ do not share an edge, u is not connectedto v. Also, since u and v are not incident to w2, (xu − xa)2 and (xv − xb)2 terms are (0 − 1)2 and(2− 1)2 respectively.

xTLG′x ≤ 1

9+

1

9+

1

9+ (degG′(u)− 1) · (1− 0)2 + degG′(v) · 1 + 1 · (1

3− 1)2 + 1 · (2

3− 1)2

= degG′(u) + degG′(v)− 1

9

Hence, xTLG′x < xTLH′x.

Lemma 3.3. If there exists four different vertices u, v, w1, w2 such that

• w1 has only two black edges (u,w1) and (w1, w2)

• (u, v) is a blue edge.

Then, there exists a vector x such that xTLH′x > xTLG′x.

Proof. Let x ∈ Rn be a vector defined as follows: xu = 0, xv = 2, xw1 = 12 and for all w 6= u, v, w1, set

xw = 1.

xTLH′x =∑

(a,b)∈EH′

(xa − xb)2

≥ (xu − xv)2 +∑

(u,a)∈EH′ ,a 6=v

(xu − xa)2 +∑

(v,b)∈EH′ ,b 6=u

(xv − xb)2

= 4 + (degH′(u)− 1) · 1 + (degH′(v)− 1) · 1= degH′(u) + degH′(v) + 2 ≥ degG′(u) + degG′(v) (Claim 3)

xTLG′x =∑

(a,b)∈EG′

(xa − xb)2

= (xu − xw1)2 + (xw1 − xw2)2 +∑

(u,a)∈EG′ ,a6=w1

(xu − xa)2 +∑

(v,b)∈EG′

(xv − xb)2

Since, G′ and H ′ do not share an edge, (xu − xa)2 and (xv − xb)2 terms are (0− 1)2 and (2− 1)2

respectively.

10

Page 11: Spectral Graph Isomorphism - University Of Illinoisvmadan2.web.engr.illinois.edu/papers/spectral...In particular, SGI is a natural approximation version of the well-known graph isomorphism

xTLG′x =1

4+

1

4+ (degG′(u)− 1) · 1 + degG′(v) · 1

= degG′(u) + degG′(v)− 1

2

Hence, xTLG′x < xTLH′x.

Lemma 3.4. If there exists a degree three vertex in G′, then there exists a vector x such that xTLH′x >xTLG′x.

Proof. Since, degG′(u) = 3, degH′(u) ≥ 2 by claim 3. Consider the underlying grid of which G is asubgraph. Pick the edge (u, v) ∈ E′H which is either not axix-parallel or is axis-parallel and v is atdistance at least 2 in the grid. Since, u has degree 3 in G′, there exists a neighbor w1 of u in G′ suchthat any path from w1 to v in G′ has length at least 3. If w1 has degree 2 in G′, then we set w2 to bethe neighbor of w1 other than u. It is straightforward to check that u, v, w1, w2 satisfy the conditionof Lemma 3.3. Hence, there exists x ∈ Rn such that xTLG′x < xTLH′x.

If w1 is not of degree 2 in G′, it must have degree 3 since there are no degree 1 vertices in G′.Let w2 be the neighbor of w1 other than u such that (u,w2) 6∈ E′H . Such a neighbor exists since uhas at most one neighbor in H ′ other than v and v is not incident to w1 due to the fact that anypath of length from w1 to v has length at least 3. Let w3 be the neighbor of w2 other than w1. Sucha neighbor must exists since there is no vertex of degree 1 in G′. Now, we prove that there verticessatisfy the condition of Lemma 3.2. By construction (u,w1), (w1, w2), (w2, w3) are black eges. Anypath from w1 to v in G′ has length at least 3 which implies that (w1, v), (w2, v) are not black edges.Also, by construction, (u, v) is a blue edge and (u,w2) is not a blue edge. Hence, by lemma 3.2 thereexists x such that xTLG′x < xTLH′x.

Lemma 3.5. If there exists a set S of vertices such that |δG′(S)| = 0 and |δH′(S)| ≥ 1, then thereexists a vector x ∈ Rn such that xTLG′x < xTLH′x.

Proof. Let x ∈ Rn be defined as follows: xu = 1 for u ∈ S and xu = 0 for u 6∈ S. Then, xTLH′x =|δH′(S)|, xTLG′x = |δG′(S)|. Hence, xTLG′x < xTLH′x.

Lemma 3.6. If there exists a cycle of length more than four in G′ such that all vertices of cycle havedegree 2 in G′, then there exists x ∈ Rn such that xTLH′x > xTLGx.

Proof. For any vertex v of the cycle C, degG′(v) = 2. By claim 3, degH′(v) ≥ 1. If there is no blueedge connecting two points of V (C) in G′, then there are at least |V (C)| edges going out of V (C) in H ′

and no edge going out of V (C) in G′. Then, by lemma 3.5, there exists x such that xTLG′x < xTLH′x.If on the other hand, there is an edge (a, b) ∈ EH′ such that a, b ∈ V (C). Let the two paths froma to b be P1 = a,w1, . . . , wk1 , b and P2 = a, v1, . . . , vk2 , b. Since, G′ and H ′ do not share any edge,min(k1, k2) ≥ 1. And since, the cycle has length at least 5, max(k1, k2) ≥ 2. Let x ∈ Rn be defined asfollows: xa = 0, xb = 1, xwi = i

k1+1 , xvi = ik2+1 and for u 6∈ V (C), set xu = 0.

11

Page 12: Spectral Graph Isomorphism - University Of Illinoisvmadan2.web.engr.illinois.edu/papers/spectral...In particular, SGI is a natural approximation version of the well-known graph isomorphism

xTLG′x =∑

(u,v)∈E′G

(xu − xv)2

=∑

(u,v)∈P1

(xu − xv)2 +∑

(u,v)∈P2

(xu − xv)2

= (k1 + 1) · 1

(k1 + 1)2+ (k2 + 1) · 1

(k2 + 1)2

=1

k1 + 1+

1

k2 + 1

≤ 1

2+

1

3=

5

6

Last inequality holds since, min(k1, k2) ≥ 1,max(k1, k2) ≥ 2.

xTLH′x =∑

(u,v)∈E′G

(xu − xv)2 ≥ (xa − xb)2 = 1

Hence, xTLG′x < xTLH′x.

Lemma 3.7. If G′ contains a set of disjoint cycles of length 4 such that blue edges only exists betweenvertices of these length 4 cycles, then there exists a hamiltonian cycle in G.

Proof. We prove that for such an instance, we can re-route the edges of the cycle such that all theblue edges match the black edges and hence, G contains a hamiltonian cycle. Consider a cycle C oflength 4 in G′ such that there is no blue edge between a vertex in the cycle and a vertex not in thecycle. Since, degG′(v) ≥ 2 for all vertices in the cycle, degH′(v) ≥ 1 by claim 3. Since, G′ and H ′ donot share any edge and the cycle has length 4, we must have degH′(v) = 1 for all v ∈ V (C). And forvertices not in the length 4 cycles, deg′H(v) = 0. Let the edges of H be F1 ∪F2 where F1 are the edgesshared between G and H and F2 are the diagonal edges in the disjoint cycles of length 4. Let C beone such cycle in G′ with vertices v1, v2, v3, v4 in this order and (v1, v3) ∈ F2, (v2, v4) ∈ F2

Proposition 3.1. Let H1 = (V, F1 ∪ F2 \ {(v1, v3), (v2, v4)} ∪ {(v1, v2), (v3, v4)}), H2 = (V, F1 ∪ F2 \{(v1, v3), (v2, v4)} ∪ {(v1, v4), (v2, v3)}). Then, one of the H1 or H2 is a cycle of length n and anotheris a set of two disjoint cycles.

We use the construction from the previous claim repeatedly and get one cycle of length n suchthat all the edges are from graph G. Hence, G contains a hamiltonian cycle.

Finishing the proof: Consider a graph G such that there is no hamiltonian cycle. Let H be a cycle oflength n. We find a vector x such that xTLGx < xTLHx. Claim 1 shows that it is sufficient to find sucha vector for graphs G′, H ′ obtained after deleting the shared edges. Claim 2 shows that it is sufficient toshow for the graph G′, H ′ after recursively deleting edges (u, v) such that degG′(u) = 1, degH′(u) = 0.If there is still a vertex with degG′(u) = 1, then degH′(u) must be at least 1 and hence, by claim 4,there exists a vector x ∈ Rn such that xTLG′x < xTLH′x and hence, xTLGx < xTLHx. Otherwise,there is no degree 1 vertex in G′. If there is a degree 3 vertex in G′, then by lemma 3.4 there existsx ∈ Rn such that xTLG′x < xTLH′x and hence, xTLGx < xTLHx. If there are no degree 1 or degree3 vertices G′, then G′ must be a collection of isolated vertices and cycles. If there is a vertex v suchthat degG′(v) = 0, degH′(v) ≥ 1, then by setting S = {v} lemma 3.5 implies that there exists a vector

12

Page 13: Spectral Graph Isomorphism - University Of Illinoisvmadan2.web.engr.illinois.edu/papers/spectral...In particular, SGI is a natural approximation version of the well-known graph isomorphism

x such that xTLG′x < xTLH′x. So, if none of the above cases occurs, then G′ is a collection of disjointcycles and blue edges are only incident of vertices of the cycle. If there is a cycle of length at least5, then by lemma 3.6 there exists x such that xTLG′x < xTLH′x. Otherwise, if there is at least oneblue edge with end points on two different cycles of length 4, then by setting S to be the vertex set ofthe cycle of length 4 Lemma 3.5 implies that there exists x such that xTLG′x < xTLH′x. So, eitherG′ and H ′ are empty or G′ contains a collection of disjoint cycles of length 4 such that blue edges arehave end points in the same cycle. In the first case, G contains a hamiltonian cycle since H ′ is emptyand in the second case G contains a hamiltonian cycle by lemma 3.7. This contradicts our assumptionthat G does not contain a hamiltonian cycle.

Proof. (Theorem 1.1) Theorem 3.1 proved above shows that G contains a hamiltonian cycle iff thereexists a permutation π such tha Lπ(H) � LG where H is a cycle of length |V (G)|. Hence, given aninstance of HCG, we input G and H to Graph-Dominance problem. This proves NP-hardness ofGraph-Dominance problem.

4 Tree Isomorphism

4.1 Necessary and Sufficient Conditions

First we start by considering some easy consequences of κ(G,H) being upper bounded by some k.Our first necessary condition says that if κ ≤ k, then any subset of nodes crosses similar number ofedges in G and H.

Lemma 4.1. For any two graphs G and H, if κ(G,H) ≤ k then 1k ≤

|δG(S)||δH(S)| ≤ k for any non-empty

subset S ( V , where δG(S), δH(S) denote the set of edges cut by (S, V − S) in G and H respectively.

Proof. We will prove |δG(S)| ≤ k|δH(S)| (the other direction is similar). Consider the indicator vectorx of S, where xu is 1 if u ∈ S and 0 otherwise. Note that (xu−xv)2 is 1 if u and v are separated by S;and 0 otherwise. In particular, xTLx = |δG(S)| by (5) (similarly for H). Substituting these into (6)yields our claim.

In Lemma 4.1, we used the definition of condition number as given in eq. (6) with indicator vectorsof subsets of nodes. On the other hand, we can also use Lemma 2.1 with eq. (6) to derive anotherextremely useful property.

Lemma 4.2. Given two trees G and H, if κ(G,H) ≤ k then 1k ≤

dG(u,v)dH(u,v) ≤ k for any pair of nodes

u 6= v ∈ V , where dG, dH are the induced graph distances of G and H respectively.

Remark 4.3. If we replace the shortest path metric in Lemma 4.2 with that of the resistance distance(the resistance between two equivalent points on an electrical network corresponding to G); then itholds for any graph [7].

Proof of Lemma 4.2. Again, we will prove only one direction. Given a pair u, v; consider the vector

x = [xa]a∈V where xa =

+1 if u = a,

−1 if v = a,

0 else.

We will prove that xTL†x = dG(u, v) when G is a tree. The

same argument also implies xTM †x = dH(u, v), finishing our proof.

Consider the path π from u to v in G. For any node a, we will abuse the notation and use π(a)to denote the closest ancestor of a along the path π, i.e., the first node in π one encounters along

13

Page 14: Spectral Graph Isomorphism - University Of Illinoisvmadan2.web.engr.illinois.edu/papers/spectral...In particular, SGI is a natural approximation version of the well-known graph isomorphism

the walk from a to (say) u. Now consider the following vector y = [ya]a∈V where ya is equal to thedistance of π(a) to u. By construction and the graph being a tree, yTLy counts the number of edgesalong the path π. Since the vector x we chose is orthogonal to all 1’s vector, whose span is equal tothe kernel of L, it suffices to prove that x = Ly.

For any a ∈ V , we have:

(Ly)a =∑

b∈N(a)

(ya − yb) =∑

b∈N(a)∩π

(ya − yb).

There are four cases, three of which are trivial:

• If a = u, then this sum is −1.

• If a = v, then this sum is +1.

• If a /∈ π, the sum becomes 0.

• Finally if a ∈ π \ {u, v}, with its successor and predecessor along π being s and t, respectively;then:

(Ly)a = (ya − ys) + (ya − yt) = 1− 1 = 0.

Therefore Ly = x = eu − ev as expected.

It turns out Lemmas 4.1 and 4.2 are also sufficient to get an upper bound on the conditionnumber [9].

Lemma 4.4. Given two graphs G and H, with Laplacian matrices L and M respectively, if there existflows f1 and f2 in G and H, respectively, such that the following conditions are true:

• For each edge (u, v) ∈ EG, f2 routes one unit of flow from u to v in H over paths of length atmost α.

• For each edge (u, v) ∈ EH , f1 routes one unit of flow from u to v in G over paths of length atmost α.

• Flow f1 and f2 have congestion at most β in G and H respectively.

Then, κ(G,H) ≤ αβ.

Proof. First we will prove that if such f2 exists, then L � αβM . For any vector x ∈ Rn:

xTLx =∑

uv∈E(G)

(xu − xv)2 =∑

uv∈E(G)

∑ab∈f2(uv)

(xa − xb)

2

≤∑

uv∈E(G)

|f2(uv)|∑

ab∈f2(uv)

(xa − xb)2

≤α∑

ab∈E(H)

∣∣{uv ∈ E(G)∣∣ab ∈ f2(uv)

}∣∣ (xa − xb)2 ≤ αβ ∑ab∈E(H)

(xa − xb)2

=αβxTMx.

Here we use f2(uv) to denote the edges along the (flow) path assigned to the demand pair u and v.The other direction is similar.

14

Page 15: Spectral Graph Isomorphism - University Of Illinoisvmadan2.web.engr.illinois.edu/papers/spectral...In particular, SGI is a natural approximation version of the well-known graph isomorphism

Theorem 4.5. Given trees G and H with Laplacian matrices L and M , respectively on the same setof nodes, let k and ` be the minimum values for which:

1. (Stretch) For any edge (u, v) of G (resp. (s, t) of H), dH(u, v) ≤ ` (resp. dG(s, t) ≤ `).

2. (Cut) For any edge (u, v) of G (resp. (s, t) of H),∣∣∣δH[TGu (v)

]∣∣∣ ≤ k (resp.∣∣∣δG[THs (t)

]∣∣∣ ≤ k).

Then max{k, `} ≤ κ(L,M) ≤ k`. Here, for two nodes u and v of a tree G, TGu (v) denotes the subtreeof G at v when u is identified as the root and δH

[TGu (v)

]denotes the corresponding set of edges in H

that cross the cut (A,A′), were A contains the set of nodes of TGu (v).

Proof. The lower bound, max{k, `} ≤ κ(L,M), follows easily from Lemmas 4.1 and 4.2.

In order to prove the upper bound, we will consider the natural multicommodity flows f1 and f2,where f1 has demands graph G and capacity graph H and f2 is vice versa. For each edge (u, v) of G,f1 has a unit flow along the unique path between u and v in H. f2 is defined similarly.

By the stretch condition, both f1 and f2 route flows through paths of length at most `. Now wewill bound the congestion. Consider any edge e = (u, v) of G. Let A be the connected componentof G containing u after removing e. Observe that this is the same as subtree of G at u when v isidentified as the root, A = TGv (u). If (s, t) is an edge of H which sends flow across e, then s and tshould lie in different connected components of G after the removal of e. If we assume, without lossof generality, that s ∈ A; then t ∈ A. So the congestion of e is equal to the number of edges of Hcrossing A, |δH(A)| = |δH [TGu (v)]| ≤ k. A similar argument shows that the dilation and congestionof H is bounded as well. Thus we can invoke Lemma 4.4 and obtain the desired upper bound,κ(G,H) ≤ k`.

4.2 Quadratic approximation for Tree Isomorphism

Our algorithm finds a mapping with optimal cut and distance distortion, thus obtaining a quadraticapproximation for Condition-Number as a corollary. Formally, our result can be stated as follows:

Theorem 4.6. Given two tree graph G and H such that there exists a mapping π : V (G) → V (H)satisfying the following properties:

• For all (u, v) ∈ E(G), dH(π(u), π(v)) ≤ `

• For all (u, v) ∈ E(H), dG(π−1(u), π−1(v)) ≤ `

• For S ⊂ V (G) s.t. |δG(S)| = 1, |δH(π(S))| ≤ k.

• For S ⊂ V (H) s.t. |δH(S)| = 1, |δG(π−1(S))| ≤ k.

Then, there exists an algorithm to find such a mapping in time nO(k2d) where d is the maximum degreeof a vertex in G or H.

Our main result, Theorem 1.2, follows immediately as a corollary:

Corollary 4.7. Given two graphs G and H with condition number k and maximum degree d, thereexists an algorithm running in time nO(k2d) which finds a mapping certifying that condition number isat most k2.

15

Page 16: Spectral Graph Isomorphism - University Of Illinoisvmadan2.web.engr.illinois.edu/papers/spectral...In particular, SGI is a natural approximation version of the well-known graph isomorphism

The algorithm proceeds by recursively finding mappings for different subtrees and merging them.Our challenge is to find partial mappings of subtrees which also map their boundaries in such a waythat enables different mappings to be appropriately merged. However, unlike most traditional dynamicprogramming algorithms, in our case, it is not enough to consider just the boundary vertices of thesubtrees and their images. Instead, we also need to consider the boundary edges of those sets, whichcorrespond to cuts induced on the graph. Hence, in addition to “guessing” the mapping of boundaryvertices we also need to “guess” the mapping of the cuts induced by the boundary edges of the partiallymapped sets. Suppose, u is a vertex in G and T uG is the subtree rooted at u in G. If TGu is mappedto the set T in H, then its boundary includes the vertex u, the edge incident to u, the boundaryvertices of T , and the cuts induced by edges going out of T . Hence, in addition to considering themapping of boundary vertices, we need to consider the mapping of sets T ′ such that δH(T ′) = {e}where e ∈ δH(T ). This notion is formalized in the following two definitions. For notational purposesit is convenient to root the trees such that we always map the two roots to each other. Let rG be theroot of tree G and rH be the root of tree H. In the remaining part of this section, we assume that kand ` are fixed to be the same as in Theorem 4.6. Also, we fix some (arbitrary) ordering L on edgesof H.

Definition 4.8. Let Γ be the set of tuples (u, T, v, u1, . . . , ux, S1, . . . , Sx) satisfying following properties:

• u, u1, . . . , ux ∈ V (G), v ∈ V (H), T ⊂ V (H), S1, . . . , Sx ⊂ V (G);

• rG 6∈ S1, . . . , Sx, rH 6∈ T ;

• u, u1, . . . , ux 6= rG, v 6= rH ;

• |δH(T )| = x ≤ k and ∀j ∈ [1, x], |δG(Sj)| ≤ k.

For α ∈ Γ, we use the indicator variable zα to denote if there is a mapping π which realizes α andpreserves the distances and cuts for edges in TGu and T . Intuitively, this mapping maps the subtreerooted at u in G to the set T in H, vertex u to vertex v. It also maps u1, . . . , ux to the vertex boundaryof the set T , and maps sets S1, . . . , Sx to the cuts induced by the boundary edges of T . The formaldefinition of zα is as follows:

Definition 4.9. For α = (u, T, v, u1, . . . , ux, S1, . . . , Sx) ∈ Γ, let δH(T ) = {e1, . . . , ex} be such that fori < j, ei is ordered before ej in ordering L. Let vj = ej ∩ T , TGu be the vertex set in the subtree rootedat u in G and for e ∈ E(G), let TGe be the vertex set in the subtree under edge e. Formally speakingTGe ⊂ V (G) such that δG(TGe ) = {e} and rG 6∈ S′ (THe is similarly defined). We define zα = 1 if thereexists a mapping π : V (G)→ V (H) such that:

(a) π(TGu ) = T, π(u) = v,∀j ∈ [1, x], π(uj) = vj , π(Sj) = THej , π(rG) = rH .

(b) ∀(u, v) ∈ E[G[TGu ]], dH(π(u), π(v)) ≤ `

(c) ∀(u, v) ∈ E[H[T ]], dG(π−1(u), π−1(v)) ≤ `

(d) ∀e ∈ E[G[TGu ]], |δH(π(TGe )| ≤ k.

(e) ∀e ∈ E[H[T ]], |δG(π−1(THe )| ≤ k.

We refer to such a mapping π as a certificate of zα = 1. Moreover, we define zα,π = 1 if π is acertificate of zα = 1 and 0 otherwise.

16

Page 17: Spectral Graph Isomorphism - University Of Illinoisvmadan2.web.engr.illinois.edu/papers/spectral...In particular, SGI is a natural approximation version of the well-known graph isomorphism

Proposition 4.10. There exists a poly(n) time algorithm which given α ∈ Γ, π : V (G) → V (H),outputs the value of zα,π.

Our goal is to design an algorithm which computes zα for every α ∈ Γ. However, for our algorithmto run in polynomial time, we need Γ to not be exponentially large.

Lemma 4.11. |Γ| ≤ nO(k2).

Proof. Let α = (u, T, v, u1, . . . , ux, S1, . . . , Sx). We prove the lemma by bounding the number ofchoices for each parameter.

• The number of choices of u is upper bounded by n.

• Since |δH(T )| = x, the number of choices δH(T ) is upper bounded by(mx

)where m is the number

of edges. By substituting m = n− 1, we get that the number of different δH(T ), i.e. the numberof different T ’s, is upper bounded by

(n−1x

).

• The number of different v and uj is at most n for each j ∈ [1, x].

• Similarly to the argument for T , the number of different Sj with |δH(Sj)| ≤ k is at most∑kt=1

(n−1t

).

For x ∈ [1, k], the number of different tuples α in Γ with |δH(T )| = x is at most:

n ·(n− 1

x

)n · nx ·

[k∑t=1

(n− 1

t

)]x= nO(k·x).

Since x ≤ k, this gives us an upper bound of nO(k2) on |Γ|.

Suppose π is the optimal mapping from G to H which yields a mapping with cut distortion k anddistance distortion ` and also certifies zα = 1 for some α. Our recursive algorithm does not necessarilyobtain the same certificate as π for zα = 1. So, before we show how to compute zα, we examinecertain properties of zα. In particular, we start by proving that if both π and γ certify zα = 1 so thatzα,π = zα,γ = 1, then they not only match on the boundary vertices but also on the cuts induced byboundary edges.

Lemma 4.12. For α = (u, T, v, u1, . . . , ux, S1, . . . , Sx), let π and γ be two mappings such that zα,π =zα,γ = 1. Then:

(a) π(u) = γ(u).

(b) π(TGu ) = γ(TGu ).

(c) For every boundary vertex w of T (in T with an incident edge in δH(T )), π−1(w) = γ−1(w).Equivalently, π(uj) = γ(uj) for j ∈ [1, x].

(d) For every edge e ∈ δH(T ), π−1(THe ) = γ−1(THe ).

(e) For every connected component C in H \ δH(T ), π−1(C) = γ−1(C).

17

Page 18: Spectral Graph Isomorphism - University Of Illinoisvmadan2.web.engr.illinois.edu/papers/spectral...In particular, SGI is a natural approximation version of the well-known graph isomorphism

Proof. Items a to d follow directly from the definition of zα,π. Consider a connected component C inH \ δH(T ). Let δH(C) = {ei1 , . . . , eit}. Without loss of generality, assume that ei1 is the edge closestto the root rH . Then:

γ−1(C) = γ−1(Tei1 ) \ ∪tj=2γ−1(Teij ).

Item c implies that γ−1(Teij ) = π−1(Teij ) for j ∈ [1, t] thus proving π−1(C) = γ−1(C).

Next lemma is somewhat like a converse of the previous lemma. It shows that if we have amapping π such that zα,π = 1 and another mapping γ such that γ matches with π on the subtree andthe boundary vertices and edges, then zα,σ = 1 as well.

Lemma 4.13. Let α = (u, T, v, u1, . . . , ux, S1, . . . , Sx) and π : V (G) → V (H) be such that zα,π = 1.Let γ : V (G)→ V (H) be such that

(a) γ(w) = π(w) for w ∈ TGu

(b) γ(uj) = π(uj) for j ∈ [1, x]

(c) γ(Sj) = π(Sj) for j ∈ [1, x] (π and γ may not be identical on every element of Sj)

Then, zα,γ = 1.

Proof. Follows immediately from Definition 4.9.

Next we show how to change the optimal mapping such that it agrees with the mapping found byour algorithm on the subtree and is still optimal. Following lemma formalizes this statement:

Lemma 4.14. Let π be a mapping such that zα,π = zα1,π = 1 where α = (a, T, b, u1, . . . , ux, S1, . . . , Sx) ∈Γ and α1 = (a1, T 1, b1, u11, . . . , u

1x1 , S

11 , . . . , S

1x1) ∈ Γ such that a1 is a child of a in G. Suppose, γ1

is another mapping such that zα1,γ1 = 1. Let ζ be defined as follows: ζ(u) = γ1(u) for u ∈ TGa1 andζ(u) = π(u) otherwise. Then, zα,ζ = 1.

Proof. Items a to d of Definition 4.9 can be easily verified for zα,ζ . Here, we prove that the followingproperty holds:

∀e ∈ E[H[T ]], |δG(ζ−1(THe ))| ≤ k.

There are three possible cases: (i) Either e = (b, b1), (ii) or e ∈ E[H[T \ T 1]], (iii) or e ∈ E[H[T 1]].We consider each case separately:

e = (b, b1): e ∈ δH(T 1). By definition, ζ−1(THe ) = γ−11 (THe ). Since, zα1,γ1 = 1, we get |ζ−1(THe )| =|γ−11 (THe )| ≤ k.

e ∈ E[H[T \ T 1]]: By definition, ζ−1(THe ) = π−1(THe ). Since, zα,π = 1,, we get |ζ−1(THe )| =|π−1(THe )| ≤ k.

e ∈ E[H[T 1]] : By definition ζ−1(THe ) = γ−11 (THe ) and since, zα1,γ1 = 1, we get |ζ−1(THe )| ≤ k.

The above lemmas show that even if we find mappings for subtrees which are different from theoptimal mappings, they can still be merged with the optimal mappings. Hence, we may just find anyof the mappings for each α and then recursively combine mappings. The following lemma states theresult and shows how to make it constructive:

18

Page 19: Spectral Graph Isomorphism - University Of Illinoisvmadan2.web.engr.illinois.edu/papers/spectral...In particular, SGI is a natural approximation version of the well-known graph isomorphism

Lemma 4.15. Let a ∈ V (G) be a vertex in G with children a1, . . . , at. Let α = (a, T, b, u1, . . . , ux, S1, . . . , Sx),α1 = (a1, T 1, b1, u11, . . . , u

1x1 , S

11 , . . . , S

1x1), . . . , αt = (at, T t, bt, ut1, . . . , u

txt , S

t1, . . . , S

txt) ∈ Γ. Let π :

V (G)→ V (H) be a mapping such that zα,π = zα1,π = · · · = zαj ,π = 1 for all j ∈ [1, t].

If for each j ∈ [1, t] there exists a mapping γj : V (G) → V (H) with zαj ,γj = 1, then there existsπ′ : V (G) → V (H) such that zα,π′ = 1 and π′(w) = γj(w) for w ∈ TGaj where j ∈ [1, t]. Moreover,given {γj | j ∈ [1, t]}, such π′ can be found in time poly(n).

Proof. Let ζ : V (G) → V (H) such that ζ(w) = γj(w) for w ∈ TGaj where j ∈ [1, t] and ζ(w) = π(w)otherwise. By Lemma 4.14, zα,ζ = 1.

Construction of π′: Let π′(w) = γj(w) for w ∈ TGaj , j ∈ [1, t] and π′(a) = b. For w 6∈ TGa , define π′

such that π′(Sj) = Tj for j ∈ [1, x].

Setting π = ζ, γ = π′ in Lemma 4.13, we get zα,π′ = 1. Easy to see that π′ is constructed inpolynomial time.

Lemma 4.15 suggests that we can recursively compute zα. Namely, we can show the following:

Lemma 4.16. There exists an algorithm with running time poly(n, |Γ|d) which calculates zα for eachα ∈ Γ. Additionally if zα = 1, it also computes πα such that zα,πα = 1.

Proof. Consider α = (a, T, b, u1, . . . , ux, S1, . . . , Sx) ∈ Γ with zα = 1 and π : V (G) → V (H) be themapping such that zα,π = 1. Let the children of a be a1, . . . , at.

Proposition 4.17. For j ∈ [1, t],∃αj = (aj , T j , bj , u1j , . . . , u1xj , S

11 , . . . , S

1xj ) ∈ Γ such that zαj ,π = 1.

To construct a mapping π′ such that zα,π′ = 1, we guess α1, . . . , αt and use Lemma 4.15 to constructsuch a mapping. It requires mapping γj such that zαj ,γj = 1 which can be assumed to be constructedrecursively. The number of choices of α1, . . . , αt is upper bounded by |Γ|t which is upper bounded by|Γ|d, as the degree of any vertex is at most d. For any such choice, algorithm in Lemma 4.15 runs intime poly(n). Hence, computing zα takes |Γ|dpoly(n) time for each α and |Γ|d+1poly(n) = poly(n, |Γ|d)time for all α ∈ Γ.

If zα = 0, then for any of the mappings π′ considered above has zα,π′ = 0. This can be checked inpoly(n) time for each π′ (Proposition 4.10).

Proof. (Theorem 4.6) Let π be a mapping π : V (G)→ V (H) such that:

(a) For all (u, v) ∈ E(G), dH(π(u), π(v)) ≤ `

(b) For all (u, v) ∈ E(H), dG(π−1(u), π−1(v)) ≤ `

(c) For S ⊂ V (G) s.t. |δG(S)| = 1, |δH(π(S))| ≤ k.

(d) For S ⊂ V (H) s.t. |δH(S)| = 1, |δG(π−1(S))| ≤ k.

First, we start by guessing the roots of G and H and define Γ. Then, using Lemma 4.16, we cancalculate zα for α ∈ Γ. It does not give us a mapping π′ satisfying the conditions above since forα = (u, T, v, u1, . . . , ux, S1, . . . , Sx) ∈ Γ, we have u 6= rG. However, a proof almost identical tothat of Lemma 4.16 works here as well. Assume rG has children a1, . . . , at. Then there exists αj =(aj , T j , bj , u1j , . . . , u

1xj , S

11 , . . . , S

1xj ) ∈ Γ such that zαj ,π = 1. Then, similarly to the proof of Lemma 4.16

we can guess αj , j ∈ [1, t] and compute π′ in time poly(n) · |Γ|d, which satisfies the conditions describedabove.

19

Page 20: Spectral Graph Isomorphism - University Of Illinoisvmadan2.web.engr.illinois.edu/papers/spectral...In particular, SGI is a natural approximation version of the well-known graph isomorphism

5 Future Work

In our paper, we proved that given two trees with small relative condition number under permutationof one of the trees, we can find a mapping with quadratic loss in performance guarantee. However,the exponent in our algorithm’s running time depends on the condition number as well. A naturalquestion to ask is whether there exists an approximation algorithm for Condition-Number on treesthat runs in polynomial time.

From a practical point of view, it is more desirable to have an algorithm that works on weightedgraphs. Hence we pose the existence of an efficient algorithm for Condition-Number even when thetrees are weighted as a future research direction in this subject. Another possible research direction isto extend our result to the families of graphs with small tree-width. As a starting point, we ask whetherthe cut and distance preservation condition can be extended to small tree-width graphs, preferablywith a loss of parameters at most polynomial in the tree-width? Our example from Appendix Asuggests that a linear loss is necessary (both grid and toroid graphs have tree-width

√n), but is this

the worst case?

Of course, the ultimate future direction is whether our results can be extended to general graphs:Does there exists a (say) quadratic approximation algorithm for Condition-Number in graphs whichruns in time nf(k,d), where k is the condition number and d is the combinatorial degree? Along thisline, it is natural to start with the investigation of necessary and sufficient conditions (as in Theo-rem 4.5) for Condition-Number that will hold on general graphs as well. We gave two constructionswhich show that a straightforward generalization of the distance to its natural counterpart, effectiveresistance, is not sufficient to bound Condition-Number even with the cut condition. We believethese constructions makes it an even more intriguing question of what kind of combinatorial conditionsthere are that allows us to certify small Condition-Number.

Finally, an orthogonal research direction to the previous ones is the use of algorithmic techniquesother than dynamic programming to obtain similar results. It is conceivable that such alternativeapproaches might be easier to extend to a wider class of graphs, some of which we mentioned above.One candidate algorithm would be to solve a convex relaxation of our problem obtained by some liftingprocedure, such as sum-of-squares hierarchy, and then bound the integrality gap or directly devise arounding algorithm.

References

[1] Laszlo Babai. Graph isomorphism in quasipolynomial time [extended abstract]. In Proceedings ofthe Forty-eighth Annual ACM Symposium on Theory of Computing, STOC ’16, pages 684–697,2016.

[2] Serge J. Belongie, Jitendra Malik, and Jan Puzicha. Shape matching and object recognition usingshape contexts. IEEE Trans. Pattern Anal. Mach. Intell., 24(4):509–522, 2002.

[3] H. Bodlaender. Dynamic programming on graphs with bounded treewidth. In Automata, Lan-guages and Programming, LNCS, page 105118, 1988.

[4] Adolfo Piperno Brendan D. Mckay. Faster isomorphism testing of strongly regular graphs. Journalof Symbolic Computation archive, 60:94–112, 2014.

[5] A. K. Chandra, P. Raghavan, W. L. Ruzzo, and R. Smolensky. The electrical resistance of agraph captures its commute and cover times. In Proceedings of the Twenty-first Annual ACMSymposium on Theory of Computing, STOC ’89, pages 574–586, 1989.

20

Page 21: Spectral Graph Isomorphism - University Of Illinoisvmadan2.web.engr.illinois.edu/papers/spectral...In particular, SGI is a natural approximation version of the well-known graph isomorphism

[6] Alistair Sinclair Claire Kenyon, Yuval Rabani. Low distortion maps between point sets. In SIAMJ. Comput, volume 39(4), page 16171636, 2004.

[7] P. G. Doyle and J. L. Snell. Random Walks and Electric Networks. ArXiv Mathematics e-prints,January 2000.

[8] S. Fortin. The graph isomorphism problem. Technical Report 96-20, 1996.

[9] Stephen Guattery and Gary L. Miller. Graph embeddings and laplacian eigenvalues. SIAM J.Matrix Analysis Applications, 21(3):703–723, 2000.

[10] Erin Wolf Chambers Ellen Gasparovic Ruizhen Hu Kathryn Leonard Matineh Shaker Car-ola Wenk Gulce Bal, Julia Diebold. Skeleton-based recognition of shapes in images via longestpath matching. In Leonard K., Tari S. (eds) Research in Shape Modeling, volume 1 of Associationfor Women in Mathematics Series, vol 1. Springer, Cham, pages 81–99, 2015.

[11] Roger A. Horn and Charles R. Johnson. Matrix analysis. Cambridge University Press, 1990.

[12] U. Schoning J. Kobler and J. Toran. The graph isomorphism problem: Its structural complexity.Progress in Theoretical Computer Science, 1993.

[13] Varun Jain and Hao Zhang. A spectral approach to shape-based retrieval of articulated 3d models.Computer-Aided Design, 39(5):398–407, 2007.

[14] Xun Wang Bryan Everding William G. Wee Lei He, Chia Y. Han. Graph matching for ob-ject recognition and recover. In Pattern Recognition, volume 37 of Association for Women inMathematics Series, vol 1. Springer, Cham, page 15571560, 2004.

[15] Bruno Levy and Hao (Richard) Zhang. Spectral mesh processing. In International Conferenceon Computer Graphics and Interactive Techniques, SIGGRAPH 2010, Los Angeles, California,USA, July 26-30, 2010, Courses, pages 8:1–8:312, 2010.

[16] Eugene M. Luks. Isomorphism of graphs of bounded valence can be tested in polynomial time.J. Comput. Syst. Sci., 25(1):42–65, 1982.

[17] Marc Niethammer, Martin Reuter, Franz-Erich Wolter, Sylvain Bouix, Niklas Peinecke, Min-Seong Koo, and Martha Elizabeth Shenton. Global medical shape analysis using the laplace-beltrami spectrum. In Medical Image Computing and Computer-Assisted Intervention - MICCAI2007, 10th International Conference, Brisbane, Australia, October 29 - November 2, 2007, Pro-ceedings, Part I, pages 850–857, 2007.

[18] Ryan O’Donnell, John Wright, Chenggang Wu, and Yuan Zhou. Hardness of robust graph iso-morphism, lasserre gaps, and asymmetry of random graphs. In Proceedings of the Twenty-fifthAnnual ACM-SIAM Symposium on Discrete Algorithms, SODA ’14, pages 1659–1677, 2014.

[19] Christos H Papadimitriou and Umesh V Vazirani. On two geometric problems related to thetravelling salesman problem. Journal of Algorithms, 5(2):231–246, 1984.

[20] Ali Shokoufandeh, Diego Macrini, Sven J. Dickinson, Kaleem Siddiqi, and Steven W. Zucker.Indexing hierarchical structures using graph spectra. IEEE Trans. Pattern Anal. Mach. Intell.,27(7):1125–1140, 2005.

[21] Daniel A. Spielman. Faster isomorphism testing of strongly regular graphs. Proc. 28th ACMSTOC, 215:576584, 1995.

21

Page 22: Spectral Graph Isomorphism - University Of Illinoisvmadan2.web.engr.illinois.edu/papers/spectral...In particular, SGI is a natural approximation version of the well-known graph isomorphism

[22] Daniel A. Spielman. Algorithms, graph theory, and linear equations in laplacian matrices. Pro-ceedings of the International Congress of Mathematicians Hyderabad, India, 2010.

[23] H. Sundar, Deborah Silver, Nikhil Gagvani, and Sven J. Dickinson. Skeleton based shape matchingand retrieval. In 2003 International Conference on Shape Modeling and Applications (SMI 2003),12-16 May 2003, Seoul, Korea, pages 130–142, 290, 2003.

[24] Regina I. Tyshkevich Viktor N. Zemlyachenko, Nikolai M. Korneenko. Graph isomorphism prob-lem. Zapiski Nauchnykh Seminarov LOMI, 215:83–158, 1982.

A Counterexample Construction

In this section, we will show the existence of two graphs which are not spectrally isomorphic to eachother yet they have similar cuts and effective resistances.

Given n of the form n = m2 for some m ≥ 2, we first consider the path and cycle graphs on mnodes:

P = ({0, 1, . . . ,m− 1}, {{0, 1}, {1, 2}, . . . , {m− 2,m− 1}};

C = ({0, 1, . . . ,m− 1}, {{0, 1}, {1, 2}, . . . , {m− 2,m− 1}, {0,m− 1}}.

Observe that P ⊂ C. We let G be the m ×m grid graph, G = P⊗2 and H be the m ×m toroidalgraph, H = C⊗2. As it was shown in [5], the effective resistance between any pair of nodes is between

1O(logn) and O(log n) in both G and H. Hence the distortion is at most O(log2 n).

Now we will show that any cut has similar cost in G and H. Since G is a subgraph of H under ourmapping, we immediately see that the number of edges crossing any cut in G is not any more than itdoes in H. For the other direction, consider the following multicommodity flow:

• For any edge of H present in G, we send 12 -unit of flow along that edge in G.

• For any edge of H not present in G, we send 12 -unit of flow along the shortest path between its

endpoints in G.

It is easy to see that any edge of G carries at most one unit of flow. Moreover, for each edge of H,this construction transmits 1

2 -unit of flow between the endpoints. Hence for any subset S, the numberof edges it cuts in G has to be at least half the number of edges it cuts in H. Consequently, all cutsbetween G and H are preserved up to a factor of 2.

Finally, we will prove that the condition number between G and H is large. For this, consider thefollowing vector, x, whose value at node (i, j) is equal to xi,j = i + j. It is easy to see that the valueof x changes by ±1 along any edge of G. Hence:

xTLGx = 2m(m− 1).

On the other hand, along the edge of H which wrap around, the value of x changes by ±(m − 1).Therefore:

xTLHx = xTLGx+ 2m(m− 1)2 = 2m2(m− 1).

This implies that:

κ(G,H) ≥ 2m2(m− 1)

2m(m− 1)= m =

√n.

22