On the graph isomorphism problem Shmuel Friedland ∗† January 9, 2008 8 0 0 Abstract 2 n We relate the graph isomorphism problem to the solvability of certain sys- a tems oflinearequationsandlinearinequalities. Thenumberofthese equations J and inequalities is related to the complexity of the graphs isomorphism and 0 subgraph isomorphim problems. 1 2000MathematicsSubjectClassification: 03D15,05C50,05C60,15A48,15A51, ] C 15A69, 90C05. C Keywords and phrases: graph isomorphism, subgraph isomorphism, tensor . products, doubly stochastic matrices, ellipsoidal algorithm. s c [ 1 Introduction 3 v 8 Let G1 = (V,E1),G2 = (V,E2) be two simple undirected graphs, where V is the set 9 ofvertices ofcardinalitynandE ,E ⊂ V ×V thesetofedges. G andG arecalled 1 2 1 2 3 isomorphic if there exists a bijection σ : V → V which induces the corresponding 0 1. bijection σ˜ : E1 → E2. The graph isomorphism problem, abbreviated here as GIP, 0 istheproblemofdetermination ifG1 andG2 areisomorphic. Clearly theGIP inthe 8 class NP.Itis oneof avery small numberof problems whosecomplexity is unknown 0 [4, 6]. For certain graphs it is known that the complexity of GIP is polynomial : v [1, 2, 3, 5, 9, 10]. i X Let G = (W,E ), where #W = m ≤ n. G is called isomorphic to a subgraph 3 3 3 r of G if there exits an injection τ :V → V which induces an injection τ˜ :E → E . 2 3 2 3 2 a The subgraph isomorphism, abbreviated here as SGIP, is the problem of determi- nation if G is isomorphic to a subgraph of G . It is well known that SGIP is 3 2 NP-Complete [4]. In theprevious versions of this paper werelated thegraph isomorphism problem tothesolvabilityofcertainsystemsoflinearequationsandlinearinequalities. Itwas pointed out to me by N. Alon and L. Babai, that my approach relates in a similar way the SGIP to the solvability of certain systems of linear equations and linear inequalities. Hence f(n), the number of these linear equalities and inequalities for V = n, is probably exponential in n. Thus, the suggested approach in this paper does not seem to be the right approach to determine the complexity of the ∗DepartmentofMathematics,Statistics,andComputerScience,UniversityofIllinoisatChicago Chicago, Illinois 60607-7045, USA,E-mail: [email protected] †Visiting Professor, Berlin Mathematical School, Institut fu¨r Mathematik, Technische Univer- sit¨at Berlin, Strasse des 17. Juni 136, D-10623 Berlin, Germany 1 GIP. Nevertheless, in this paper we summarize the main ideas and results of this approach. It seems that our approach is related to the ideas and results discussed in [11]. Let Ωn ⊂ R+n×n be the convex set of n×n doubly stochastic matrices. In this paper we relate the complexity of the GIP to the minimal number of supporting hyperplanesdetermininga certain convex polytopeΨ ⊂ Ω . More precisely, two n,n n2 graph are isomorphic if certain system of n2 hyperplanes intersect Ψ . More gen- n,n eral, if the correspondingsystem n2 half spaces intersect Ψ then G is isomorphic n,n 3 to a subgraphof G . Hence the minimal number of supportinghyperplanes defining 2 Ψ , denoted by f(n), is closely related to the complexity of SGIP. We give a n,n larger polytopeΦ , characterized by (4n−1)n2 linear equations in n4 nonnegative n,n variables satisfying Ψ ⊂ Φ ⊂ Ω . (1.1) n,n n,n n2 In the first version of this paper we erroneously claimed that Φ = Ψ . The n,n n,n error in my proof was pointed out to me by Babai, Melkebeek, Rosenberg and Vavasis. The inequality Ψn,n $ Φn,n for n ≥ 4 is implied by the example of J. Rosenberg. Thusiftwographsareisomorphicthencertainsystemofn2hyperplanesintersect Φ . This of course yields a necessary conditions for GIP and SGIP. n,n We now outline the main ideas of the paper. Let A,B be n × n adjacency matrices of G ,G . So A,B are 0−1 symmetric matrices with zero diagonal. It is 1 2 enough to consider the case where A and B have the same number of 1’s. Let P be n the set of n×n permutation matrices. Then G and G are isomorphic if and only 1 2 if PAP⊤ = B for some P ∈ P . It is easy to see that this condition is equivalent n P(A+2I )Q⊤ = B+2I for some P,Q ∈ P , (1.2) n n n where I is the n×n identity matrix. n For C,D ∈ Rn×n denote by C ⊗ D ∈ Rn2×n2 the Kronecker product, see §2. Let Pn ⊗ Pn := {P ⊗ Q, P,Q ∈ Pn}. Denote by Ψn,n ⊂ Rn+2×n2 the convex set spanned by P ⊗P . Ψ is a subset of n2 × n2 doubly stochastic matrices. n n n,n Then the condition (1.2) implies the solvability of the system of n2 equations of the form Z(A\+2In) = B\+2In for some Z ∈ Ψn,n. Here B\+2In ∈ Rn2 is a column vector composed of the columns of B +2I . Vice versa, the solvability of n Z(A\+2I ) = B\+2I for some Z ∈ Ψ implies (1.2). The ellipsoid algorithm n n n,n in linear programming [8, 7] yields that the existence a solution to this system of equations is determined in polynomial time in max(f(n),n). Similarly, for the SGIPoneneedstoconsiderthethesolvabilityofZ(C +\2n2I )≤ B \+2n2I forsome n n Z ∈ Ψ , whereC is the adjacency matrix of thegraph G˜ = (V,E ) obtained from n,n 3 3 G by appending n−m isolated vertices. 3 We now survey briefly the contents of this paper. In §2 we introduce the needed conceptsfromlinearalgebratogivethecharacterizationofΦ intermsof(4n−2)n2 n,n linear equations in n4 nonnegative variables. This is done for the general set Φ , m,n which contains Ψ , the convex hull of P ⊗P . §3 discusses the permutational m,n m n similarity of A,B ∈ Rn×n and permutational equivalence of A,B ∈ Rn×m. We show the second main result that the permutational similarity and equivalence is equivalent to solvability of the corresponding system of equations discussed above. In §4 we deduce the complexity results claimed in this paper. 2 This paper generated a lot of interest. I would like to thank all the people who sent their comments to me. 2 Tensor products of doubly stochastic matrices For m ∈N denote hmi := {1,...,m}. For A ⊂ R denote by Am×n the set of m×n matrices A = [aij]mi,j,=n1 such that each aij ∈ A. Recall that A = [aij] ∈ Rm+×m is called doubly stochastic if m m a = a = 1, i= 1,...,m. (2.1) ij ji Xj=1 Xj=1 SincethesumofallrowsofAisequaltothesumofallcolumnsofAitfollowsthatat most 2m−1 of above equations are linearly independent. It is well known that any 2m−1 of the above equation are linearly independent. Let 1 := (1,...,1)⊤ ∈ Rm. + Note that A= [aij]∈ Rm×m satisfies (2.1) if and only if and A1 =A⊤1= 1. Denote by Ω the set of doubly stochastic matrices. Clearly, Ω is a convex m m compact set. Birkhoff theorem claims that the set of the extreme points of Ω is m the set of permutations matrices P ⊂ {0,1}m×m. m Lemma 2.1 Denote by Λm ⊂ Rm+×m the set of nonnegative matrices satisfying the conditions A1 = A⊤1 = a1 for some a ≥ 0 depending on A. Then Λ is a m multiplicative cone: Λ +Λ = Λ , aΛ ⊂Λ for all a≥ 0, Λ ·Λ = Λ . m m m m m m m m Furthermore, A = [aij] ∈ Rm+×m is in Λm if and only if the following 2(m − 1) equalities hold. m m m a = a = a for i = 2,...,m. (2.2) ij ji 1j Xj=1 Xj=1 Xj=1 Proof. The fact that Λ is a cone is straightforward. Since I ∈ Λ we m m m deduce the equality Λ ·Λ = Λ . Observe next that the conditions (2.2) imply m m m that A1 = a1, where a is the sum of the elements in the first row. Also the sum of the elements in each column except the first is equal to a. Since the sum of all elements of A is ma it follows that the sum of the elements in the first column is also a, i.e A⊤1 = a1. 2 For A= [aij] ∈ Rm×m,B = [bkl] ∈Rn×n denote by A⊗B ∈ Rmn×mn the tensor product of A and B. The rows and columns of A⊗B are indexed by double indices (i,k) and (j,l), where i,j = 1,...m, k,l = 1,...,n. Thus A⊗B = [c(i,k)(j,l)]∈ Rmn×mn, (2.3) where c = a b for i,j = 1,...,m, k,l = 1,...,n. (i,k)(j,l) ij kl If we arrange the indices (i,k) in the lexicographic order then A⊗ B has the following block matrix form called the Kronecker product 3 a B a B ... a B 11 12 1m a21B a22B ... a2mB A⊗B = . . . . (2.4) . . . . . ... . a B a B ... a B m1 m2 mm For simplicity of the exposition we will identify A⊗B with the block matrix (2.4) unless stated otherwise. Note that any other ordering of hmi×hni induces a dif- ferent representation of A⊗B as C ∈ Rmn×mn, where C = P(A⊗B)P⊤ for some permutation matrix P ∈ P . mn Recall that A⊗B is bilinear in A and B. Furthermore (A⊗B)(C ⊗D) =(AC)⊗(BD) for all A,C ∈ Rm×m, B,D ∈ Rn×n. (2.5) Proposition 2.2 Let A ∈ Ω ,B ∈ Ω . Then A⊗B ∈ Ω . m n mn Proof. Clearly A⊗B is a nonnegative matrix. Assume the representation (2.3). Then m,n m,n m n c = a b =( a )( b )= 1·1 = 1, (i,k)(j,l) ij kl ij kl jX,l=1 jX,l=1 Xj=1 Xl=1 m,n m,n m n c = a b = ( a )( b )= 1·1 = 1. (j,l)(i,k) ji lk ji lk jX,l=1 jX,l=1 Xj=1 Xl=1 2 Lemma 2.3 Denote by Ψ ⊂ Ω the convex hull spanned by Ω ⊗Ω , i.e. m,n mn m n all doubly stochastic matrices of the form A⊗B, where A ∈Ω , B ∈ Ω . Then the m n extreme points of Ψ is the set P ⊗P , i.e. each extreme point is of the form m,n m n P ⊗Q, where P ∈ P ,Q ∈P . m n Proof. Use Birkhoff’s theorem and the bilinearity of A⊗B to deduce that Ψ is spanned by P ⊗P . Clearly P ⊗P ⊂ P . Since Birkhoff’s theorem m,n m n m n mn implies that P are extreme points of Ω it follows that P ⊗ P ⊂ P are mn mn m n mn convexly independent. 2 Theorem 2.4 Let Φ be the convex set of mn × mn nonnegative matrices m,n characterized by2mn+(2n−2)m2+(2m−2)n2 linear equationsof the following form. View C ∈ Rmn×mn as a matrix with entries c(i,k)(j,l) where i,j = 1,...,m, k,l = 1,...,n. Then C ∈ Rm+n×mn belongs to Φm,n if the following equalities hold. 4 m,n m,n c = c = 1, i = 1,...,m, k = 1,...,n, (2.6) (i,k),(j,l) (j,l)(i,k) jX,l=1 jX,l=1 m m m m c = c , c = c (2.7) (i,k)(j,l) (1,k)(j,l) (j,k)(i,l) (1,k)(j,l) Xj=1 Xj=1 Xj=1 Xj=1 where i = 2,...,m and k,l = 1,...,n, n n n n c = c , c = c (2.8) (i,k)(j,l) (i,1)(j,l) (i,l)(j,k) (i,1)(j,l) Xl=1 Xl=1 Xl=1 Xl=1 where k = 2,...,n and i,j = 1,...,m. Furthermore Ψ ⊂ Φ ⊂ Ω (2.9) m,n m,n mn Proof. The conditions (2.6) state that C ∈ Ω . We now show the condi- mn tions Ψ ⊆ Φ . Let A ∈ Ω ,B ∈ Ω and consider the Kronecker product (2.4). m,n m,n m n Then for i,j ∈ hmi, the (i,j) block of A⊗B is a B ∈ Λ . Since Λ is a cone, it ij n n follows that for any C ∈ Ψm,n, having the block form C = [Cij], Cij ∈ R+n×n, i,j ∈ hmi, each C ∈ Λ . Lemma 2.1 yields the conditions for each i,j ∈ hmi. Since ij n A⊗B = P(B ⊗A)P⊤ we also deduce the conditions (2.7) for each k,l ∈ hni. 2 Lemma 2.5 Ψ = Φ . 2,2 2,2 Proof. Let D = [d ]4 ∈ Φ . Since pq p,q=1 2,2 d d d d F := 11 12 ,F := 13 14 ∈ Λ 11 (cid:20) d21 d22 (cid:21) 12 (cid:20) d23 d24 (cid:21) 2 it follows that d = d = a, d =d = b, d = d = c, d = d = d. 11 22 12 21 13 24 14 23 Since d d d d G := 11 13 ,G := 12 14 ∈ Λ 11 (cid:20) d31 d33 (cid:21) 12 (cid:20) d32 d34 (cid:21) 2 it follows that d = c, d = d, d = a, d = b. 31 32 33 34 Since d d d d F := 31 32 ,F := 33 34 ∈ Λ 21 (cid:20) d d (cid:21) 22 (cid:20) d d (cid:21) 2 41 42 43 44 it follows that d = d, d = c, d = b, d = b. 41 42 43 44 So a,b,c,d ≥ 0 and a+b+c+d = 1. This set has 4 extreme points which form the set P ⊗P . 2 2 2 The following result was communicated to me by J. Rosenberg. Recall that P ∈ P is called a cyclic permutation if n Pi is a matrix whose all entries are n i=1 equal to 1. P 5 Lemma 2.6 Let P,Q ∈ P be cyclic permutations. Then the block matrix D = n 1[PiQj]n belongs to Φ . If P 6= Qi for i = 1,...,n − 1 then D 6∈ Ψ . In n i,j=1 n,n n,n particular Ψn,n $ Φn,n for n ≥ 4. For n= 3 each D of the above form is in Ψ3,3. Proof. Since Pi,Qj ∈ Ω it follows that PiQj ∈ Ω for i,j = 1,...,n. n n Hence the conditions (2.8) and (2.6) are satisfied. It is left to show the conditions (2.7). Denote Ai = [a(i)]n ,Bj = [b(j)]n ∈ Ω . View D = [c ]. Then kp k,p=1 pl p,l=1 n (i,k)(j,l) n 1 (i) (j) c = a b , i,j,k,l = 1,...,n. (2.10) (i,k)(j,l) n kp pl Xp=1 Since n b(j) = 1 for p,l = 1,...,n and Ai ∈ Ω we obtain 1 c = j=1 pl n n j=1 (i,k)(j,l) 1 n Pa(i) = 1. In a similar way we deduce that n c =P1. So D ∈ Φ . n p=1 kp n j=1 (j,k)(i,l) n n,n PSuppose that D ∈ Ψn,n. Observe that PnQPn = InIn = In. Assume D as a convex combination of some extreme points U ⊗ V ∈ P ⊗ P with positive n n coefficients. Express U⊗V as a block matrix [(U⊗V) ]n . Suppose furthermore ij i,j=1 that (U⊗V) 6= 0 . Then V = I . Hence there exists j ∈ hn−1i such PQj = I, nn n×n n i.e P = Qn−j. If P is not a power of Q we deduce that D 6∈ Ψ . For n ≥ 4 it is n,n easy to construct such two permutations. For example, let P and Q are represented by the cycles 1 → 3 → 2 → 4→ ... → n → 1, 1 → 2 → 3 → 4 → ... → n → 1. If n = 3 then one has only two cycles R and R2. A straightforward calculation show that if P,Q ∈ {R,R2} the D ∈ Ψ . 2 3,3 Note that the system (2.6) has 2mn−1 linear independent equations. Since any permutation matrix is an extreme point in Ω we deduce. mn Corollary 2.7 The convex set Φm,n ⊂ Rm+n×mn is given by at most 2((n − 1)m2 + (m − 1)n2 + mn)− 1 linear equations. It contains all the extreme points P ⊗P of Ψ . m n m,n It is interesting to understand the structure of the set Φ and to characterize m,n it extreme points. It is easy to characterize the following larger set. Lemma 2.8 Let Θ be the convex set of mn × mn nonnegative matrices m,n characterized by 2mn + (2n − 2)m2 linear equations of the following form. View C ∈ Rmn×mn as a matrix with entries c(i,k)(j,l) where i,j = 1,...,m, k,l = 1,...,n. Then C ∈ Rm+n×mn belongs to Θm,n if the equalities (2.6) and (2.8) hold. Then Φ ⊂ Θ ⊂ Ω . Furthermore, any C = [C ]m ∈ Θ is of the following m,n m,n mn ij i,j=1 m,n form C = a D , D ∈ Ω , i,j = 1,...,m, A = [a ]m ∈ Ω . (2.11) ij ij ij ij n ij i,j=1 m In particular, the extreme points of Θ are of the the above form where A ∈ m,n P ,D ∈ P for i,j = 1,...,n. m ij n 6 Proof. Observe first that C in the block from C = [Cij], Cij ∈ Rn×n where Cij ∈ R+n×n. Conditions (2.8) equivalent to the assumptions that Cij ∈ Λn. Hence C = f D for some D ∈ Ω and f ≥ 0. If f = 0 we can choose any D ∈ Ω . ij ij ij ij n ij ij ij n If fij > 0 then Dij is a unique doubly stochastic matrix. Let F = [fij] ∈ Rm×m. Then the conditions (2.6) are equivalent to the condition that F ∈ Ω . Thus the m conditions (2.8) and (2.6) are equivalent to the statement that C = [f D ] where ij ij each D ∈Ω and F =[f ]∈ Ω . ij n ij m Sincetheextremepoints of Ω areP wededucethatany extreme pointof Θ n n m,n is of the block form C = [f P ] where each P ∈ P . Since the extreme points ij ij ij n of Ω are P it follows that the extreme points of Θ are of the form E = [E ] m m m,n ij satisfying the following conditions. There exists a permutation σ : hmi → hmi such that E ∈ P for i= 1,...,m and E = 0 otherwise. 2 iσ(i) n ij m×m 3 Permutational similarity and equivalence of matrices For A ∈ Rn×n denote by trA the trace of A. Recall that hA,Bi, the standard inner product on Rn×n, is given by trAB⊤. We say that A,B ∈ Rn×n are permutationally similar, and denote it by A ∼ B if B = PAP⊤. Clearly, if A ∼ B then A and B have the same characteristic polynomial, i.e. det(xI −A) = det(xI −B). In whatfollows we need the following n n three lemmas. The proof of the first two straightforward and is left to the reader. Lemma 3.1 Let A = [aij],B = [bij] ∈ Rn×n. Assume A ∼ B. Then the following conditions hold. P(a ,...,a )⊤ = (b ,...,b )⊤ for some P ∈P , (3.1) 11 nn 11 nn n R(a ,...,a ,a ,a ,...,a ,...,a ,...,a )⊤ = (3.2) 12 1n 21 23 2n n1 n(n−1) (b ,...,b ,b ,b ,...,b ,...,b ,...,b )⊤ for some R ∈ P . 12 1n 21 23 2n n1 n(n−1) n2−n Lemma 3.2 Assume that A,B ∈ Rn×n satisfy the conditions (3.1) and (3.2). Then tr(A+tIn)(A+tIn)⊤ = tr(B +tIn)(B +tIn)⊤ for each t ∈ R. Lemma 3.3 Let A = [aij],B = [bij] ∈ Rn×n satisfy the conditions (3.1) and (3.2). Fix t ∈ R such that t 6= a −a for each i,j,k ∈ hni such that i 6= j. Then ij kk the following conditions are equivalent. 1. A ∼ B. 2. B +tI = P(A+tI )Q⊤ for some P,Q ∈ P . n n n Proof. Suppose that 2 holds. Hence there exists two permutations σ,η : hni → hni such that b +tδ =a +tδ for all i,j ∈ hni. ij ij σ(i)η(j) σ(i)η(j) Assume that σ 6= η. Then there exists i 6= j ∈hni such that σ(i) = η(j) = k. Hence b = a +t. The condition (3.2) implies that b = a for some i 6= j ∈ hni. ij kk ij i1j1 1 1 7 So t = a −a , which contradicts the assumptions of the lemma. Hence σ = η i1j1 kk which is equivalent to P = Q. Thus B +tI =P(A+tI )P⊤ =PAP⊤ +tI ⇒ B = PAP⊤. n n n Reverse the implication in the above statement to deduce 2 from 1. 2 We recall standard facts from linear algebra. Lemma 3.4 LetX = [xlj]nl,j,m=1 = [x1 x2...xm]∈ Rn×m, where x1,...,xm ∈Rn are the m columns of X. Denote by Xˆ ∈ Rmn the column vector composed of the columns of X, i.e. (Xˆ)⊤ = (x⊤1,x⊤2,...,x⊤m). Let A = [aij] ∈ Rm×m,B = [bkl] ∈ Rn×n. Consider the linear transformation of Rm×n to itself given by X 7→ BXA⊤ = [(BXA⊤) ]n,m : ki k,i=1 m,n (BXA⊤) = a b x , k = 1,...,n, i = 1,...,m. (3.3) ki ij kl lj jX,l=1 Then this linear transformation is represented by the Kronecker product A⊗B. That is, B\XA⊤ =(A⊗B)Xˆ for all X ∈ Rn×m. (3.4) Proof. Observe firstthat BX = [Bx Bx ...Bx ]. This shows (3.4) in the 1 2 m case A = I . Consider now the case B = I . A straightforward calculation shows m n that (A⊗I )Xˆ = X[A⊤. Since A⊗B = (A⊗I )(I ⊗B) we deduce the equality n n m (3.4). 2 Theorem 3.5 Let A = [aij],B = [bij] ∈ Rn×n. The following conditions are equivalent. 1. A ∼ B. 2. The following conditions hold. (a) The conditions (3.1) and (3.2) hold. (b) Fix t ∈ R such that t 6= a −a for each i,j,k ∈ hni such that i 6= j. ij kk Then there exists Z ∈Ψ satisfying Z(A\+tI ) = B\+tI . n,n n n Proof. Assume 1. So B +tI = P(A+tI )P⊤ for some P ∈ P and each n n n t ∈ R. Use Lemma 3.4 to deduce that (P ⊗ P)(A\+tIn) = B\+tIn. Hence the condition 2b holds. Lemma 3.1 yields the conditions (3.1) and (3.2). Assume 2. Use Lemma 3.2 yields that tr(A+tI )(A+tI )⊤ = tr(B+tI )(B+ n n n tI )⊤. We claim that n max trP(A+tI )Q⊤(B +tI )⊤ = max (B\+tI )⊤Y(A\+tI ). (3.5) n n n n P,Q∈Pn Y∈Ψn,n To find the maximum on the right-hand side it is enough to restrict the maximum on the right-hand side to the extreme points of Ψ . Lemma 2.3 yields that the n,n extreme points of Ψ are P ⊗P . Let Y = Q⊗P ∈P ⊗P . (3.4) yields that n,n n n n n (B\+tI )⊤Y(A\+tI ) =trP(A+tI )Q⊤(B +tI )⊤. n n n n 8 Comparetheabove expressionwiththeleft-handsideof(3.5)todeducetheequality in (3.5). Assume that the maximum in the left-hand side of (3.5) is achieved for P ,Q ∈ ∗ ∗ P . Use Cauchy-Schwarz inequality to deduce that n trP (A+tI )Q⊤(B +tI )⊤ ≤ ∗ n ∗ n ((trP∗(A+tIn)(A+tIn)⊤P∗⊤)tr(B +tIn)(B +tIn)⊤)21 = tr(B +tIn)(B +tIn)⊤. Equality holds if and only if B +tI = P (A+tI )Q⊤. The assumption 2b yields n ∗ n ∗ the opposite inequality tr(B +tI )(B +tI )⊤ =(B\+tI )⊤Z(A\+tI )≤ n n n n max (B\+tI )⊤Y(A\+tI )= trP (A+tI )Q⊤(B +tI )⊤. n n ∗ n ∗ n Y∈Ψn,n Hence B +tI = P (A+tI )Q⊤. Lemma 3.3 implies that A∼ B. 2 n ∗ n ∗ The proof of the above theorem yields. Corollary 3.6 Assumethattheconditions 2ofTheorem3.5holds. LetΨ (A,B) n,n be the set of all Z ∈ Ψ satisfying the condition Z(A\+tI ) = B\+tI . Then all n,n n n the extreme points of this compact convex set are of the form P⊗P ∈ P ⊗P where n n PAP⊤ = B. A,B ∈ Rn×n are called permutationally equivalent, denoted as A ≈ B, if B = PAQ⊤ for some P ∈ P ,Q ∈ P . Thearguments of the proof of Theorem 3.5 yield. n m Theorem 3.7 Let A,B ∈ Rn×m. The following conditions are equivalent. 1. A ≈ B. 2. trAA⊤ = trBB⊤ and there exists Z ∈ Ψ satisfying ZA = B. That is, m,n view the entries of Z as z where i,j ∈ hmi,k,l ∈ hni. Then these (i,k),(j,l) b b m2n2 nonnegative variables satisfy 2((n−1)m2+(m−1)n2+mn) conditions (2.6-2.8) and the mn conditions: m,n z a = b for k = 1,...,n, i = 1,...,m. (3.6) (i,k)(j,l) lj ki jX,l=1 Corollary 3.8 Assumethattheconditions 2ofTheorem3.7holds. LetΨ (A,B) m,n be the set of all Z ∈ Ψ satisfying the condition ZA = B. Then all the extreme m,n points of this compact convex setare of the form Q⊗P ∈ P ⊗P where PAQ⊤ = B. m n b b 4 GIP and SGIP 4.1 Graph isomorphisms Theorem 4.1 AssumethatΨ ischaracterized byf(n)numberoflinearequal- n,n ities and inequalities. Then isomorphism of two simple undirected graphs G = 1 (V,E ), G = (V,E )where#V = nisdecidableinpolynomial timeinmax(f(n),n). 1 2 2 9 Proof. Let A,B ∈ {0,1}n×n be the adjacency matrices of G ,G respec- 1 2 tively. Recall that A,B are symmetric and have zero diagonal. G and G are 1 2 isomorphic if and only if A ∼ B. It is left to show that the conditions 2 of Theorem 3.5 can be verified in polynomial time in max(f(n),n). 2a means that G and G 1 2 have the same degree sequence. This requires at most 4n2 computations. Assume that 2a holds. Note that t = 2 satisfies the first part of the condition 2b. The existence of Z ∈ Ψ satisfying Z(A\+2I ) = B\+2I is equivalent to the solvabil- n,n n n ity of f(n)+n2 linear equations and inequalities in n4 nonnegative variables. The ellipsoid method [8, 7] yields that the existence or nonexistence of such X ∈ Ψ is n,n decidable in polynomial time in max(f(n),n). 2 Theorem 4.2 AssumethatΨ ischaracterized byf(n)numberoflinearequal- n,n ities and inequalities. Then the isomorphism of two simple directed graphs G = 1 (V,E ), G = (V,E ), (self-loops allowed), where #V = n is decidable in polyno- 1 2 2 mial time in max(f(n),n). Proof. Let A,B ∈ {0,1}n×n be the adjacency matrices of G ,G respectively. 1 2 Apply part 2 of Theorem 3.5 with t = 2 to deduce the theorem. 2 The application of part 2 of Theorem 3.5 yields. Theorem 4.3 AssumethatΨ ischaracterized byf(n)numberoflinearequal- n,n ities and inequalities. Let A,B ∈Rn×n. Then permutational similarity of A and B is decidable in polynomial time in max(f(n),n) and the entries of A and B. Let G = (V ∪V ,E) be an undirected simple bipartite graph with the set of 1 2 vertices divided to two classes V ,V such that E ⊂ V ×V . Assume that #V = 1 2 1 2 1 n,#V = m and identify V ,V with hni,hmi respectively. Then G is represented by 2 1 2 the incidence matrix A = [a ] ∈ {0,1}n×m where a = 1 if and only if the vertices ij ij i ∈ hni,j ∈ hmi are connected by an edge in E. Let H = (V ∪V ,F) be another 1 2 bipartite graph with the incidence matrix B ∈ {0,1}n×m. If m 6= n then G and H are isomorphic if and only if A≈ B. If m = n G and H are isomorphic if and only if either A ≈ B or A≈ B⊤. Theorem 3.7 yields. Theorem 4.4 Assume that Ψ is characterized by a g(m,n) number of lin- m,n ear equalities and inequalities. The isomorphism of two simple undirected bipartite graphs G = (V ∪V ,E ), G = (V ∪V ,E ) where #V = n,V = m is decidable 1 1 2 1 2 1 2 2 1 2 in polynomial time in max(g(m,n),n+m). Theorem 4.5 Assume that Ψ is characterized by g(m,n) number of linear m,n equalities and inequalities. Let A,B ∈ Rn×m. Then permutational equivalence of A and B is decidable in polynomial time in max(g(m,n),n+m) and the entries of A and B. We now remarkthat if we replace in Theorem3.5 andTheorem 3.7 thesets Ψ n,n andΨ bythesets Φ andΦ respectively, wewillobtainnecessaryconditions m,n n,n m,n for permutational similarity and equivalence, which can be verified in polynomial time. 10