# Regular Graphs and Isomorphism

I would like to ask whether there is an already published result on that:

We take all possible different paths between each pair of nodes of two connected regular (with degree $d$ let's say, and number of nodes $n$) graphs and write down their lengths. Of course this number of distinct paths is exponential. My question is, if we sort the lengths and compare them (the lists obtained by the two graphs) and they are exactly the same, can we say that the two graphs are isomorphic?

Of course, even if this is a result we cannot use it to reply for Graph Isomorphism, since the number of distinct paths is exponential, as said

By distinct paths, I refer to paths having at least one different node, obviously.

Thanks in priori for your help.

• in 2-regular graphs there is a very small number of different paths, as a 2-regular graph is a disjoint union of cycles. Hence you either have 2 or 0 paths between each pair of vertices. – Nathann Cohen Apr 28 '11 at 5:47
• This question, while interesting, seems better suited for MathOverflow to me. – Niel de Beaudrap Apr 28 '11 at 6:09

## 3 Answers

I believe the answer to your question is "no" because an equivalent condition would imply a polynomial time solution to GI.

For $A$, the adjacency matrix of the graph $G$, note that the number of paths from $i$ to $j$ of length $k$ is $(A^k)_{i, j}$ (with repetition of vertices and edges allowed). For two graphs $G_1$ and $G_2$ (with adjacency matrices $A_1$ and $A_2$) and $k \ge 1$, if you sorted the elements of $A_1^k$ and $A_2^k$ then in order for $G_1$ to be isomorphic to $G_2$, it is a necessary condition that the lists be identical for all $k$.

I believe your conjecture is equivalent to:

If the sorted lists of elements of $A_1^k$ and $A_2^d$ are identical for $k = 1$ to $n - 1$ (upperbound on the longest path with non-repeating vertices) then $G_1$ and $G_2$ are isomorphic.

So to solve GI, one only has to perform $n - 1$ multiplications of $n \times n$ matrices (and a little extra time to sort and compare $n^2$ elements). This would take less than $n^4$ time.

I admit two possible flaws in my argument. First, it is totally possible that GI has a polynomial time algorithm and that we just discovered it together, just now (hooray, we're famous!). I find this highly unlikely. Second (and much more probable), what I've proposed is not actually equivalent to your conjecture.

Final thought. Have you tried this out for all, say, 3-regular graphs for size 8 or so? I would think that if your conjecture is false, that there should be a counter example in 3-regular graphs of fairly small size.

• I did not know that the number of distinct paths from i to j of length k is $(A^{k})_{i,j}$. If so, and if I am understanding well what you are doing, then my initial hypothesis is answered. – N27 Apr 28 '11 at 14:47
• @N27: It can be proved using the definition of matrix multiplication and induction. – Tomek Tarczynski Apr 28 '11 at 15:16
• Yes, easily, in fact... – N27 Apr 28 '11 at 15:38
• Ah, it appears that once again my intuition led me astray. Counting the number of distinct simple paths in a graph (or even just between 2 nodes) is #P-complete. So my argument is wrong because it says that a polynomial time algorithm is equivalent to counting simple paths. I'm also now completely unsure if your conjecture is correct or not. However, its a bit moot point because you're not likely to choose to solve a #P-complete problem over GI. – bbejot May 4 '11 at 19:37

Since you're only comparing the lengths of the paths (and in the meantime forgetting what pair of nodes they correspond to if I understood you well), I think that very similar graphs should provide a counterexample : in the end you're just counting the number of paths of a fixed length and independently of the vertices they link. For example I think these graphs are a counterexample : http://www.mathe2.uni-bayreuth.de/markus/REGGRAPHS/GIF/06_3_3-2.gif and http://www.mathe2.uni-bayreuth.de/markus/REGGRAPHS/GIF/06_3_3-1.gif

If I'm not mistaken (counting paths is tedious), they both have 9 paths of length 1, 18 paths of length 2, 48 paths of length 3, 30 paths of length 4 and 36 paths of length 5

• I count 36 paths of length 3 in the first graph and 30 graphs of length 3 in the second graph. The problem is that the second graph has cycles of length 3 where the first graph does not. I still agree, however, that there should be a relatively small graph as a counterexample. I havent found one yet, though. – bbejot May 2 '11 at 2:31
• I agree with you, writing a program testing all the small graphs would probably give a quick answer. – Arnaud May 2 '11 at 11:19
36
011111111111111100000000000000000000
101111110000000011111111000000000000
110111001100000011000000111111000000
111000101011000010110000110000111000
111000101010100000001110001110000110
111000010110010001001001001001110001
110110001000011000100101000100101101
110001000101101010000111100000010011
101110100000010100000010100011011011
101001010001100110100000000111100101
100111000001110000011000011000110110
100100010110001110101000101000001110
100010010110001100010110010110110000
100001101010001101010001010001000111
100000110001110101000101111100001000
100000001101111001111010000011001000
011100010101000001010100010010001111
011001000000011110011010011100001001
010100100101000100011011100101100100
010100000010110111100011010010100010
010011000011000101100110001001011100
010010110000101010001001010011011100
010010011000100101111000100100010011
010001110000011000110100101011100010
001100011001001000100011011101010010
001100000010111011010100100101010100
001011000011001001001001100110101010
001010100100101001100010111000100101
001010001100100110010101001001101010
001001001100010100101101110010010100
000101100110100000110001001110011001
000101011010100000001110110001101001
000100101001001111001100001010110001
000010100111010010101100010101000011
000010011011010010010011101010000101
000001111100010011000010000100111110

011111111111111100000000000000000000
101111110000000011111111000000000000
110111001100000011000000111111000000
111000101011000010110000110000111000
111000101010100001001100001100000111
111000010110010000100011100011000110
110110001000011000011010000010110101
110001000101101010011001000001001011
101110100000010100000001011001101011
101001010001100110000010011010010101
100111000001110000100100100100011110
100100010110001110010100010100100110
100010010110001101101000101000011001
100001101010001100000111000111011000
100000110001110101011000100111100000
100000001101111001100111011000100000
011100010101000000001101001110111000
011010000000101100110101110110000001
010101000010100101010011101000110010
010100110001001001100010010101010011
010010110000101010000110101001101100
010010000011010111001011010100001100
010001100100010100111100011001010100
010001011000010111100100000010101011
001101000010101001101000010011101100
001100001101000101010110100001001101
001010001100100110101010000101110010
001010000011011011010100001011010010
001001100100011011000001100100110101
001001011000011000011010111100001010
000100101001001110101001101010000110
000100100110110010110010001110001001
000100011010110010001101110001010001
000011100111000000001110110010100011
000011011011000000110001001101100101
000010111100100001010001010010011110

36
011111111111111100000000000000000000
101111110000000011111111000000000000
110111001100000011000000111111000000
111000101011000010110000110000111000
111000101010100001001100001100000111
111000010010011000100011101011000100
110110001000010100011010000010110110
110001000001101110001011110000000011
101110100000011000000001010101101011
101000000001111111010100000111010000
100111000001110000100100101000011101
100100010110001110010100011000100101
100010010110001101101000100100011010
100001101110000100000111000011011001
100001011101100000110001000101100110
100000110101110001001010011010101000
011100010101000000001101100110110001
011010000100100100110101011010001010
010101000010101001010011001100111000
010100100101001001100110010001010110
010010110000100110000110100101101100
010010000111010011011001000001001101
010001110000010100111000011101010001
010001011000011011100100000010101011
001101010010100010001000010011011110
001100011001000101010010101001001011
001011000011000101100010010110100101
001010001100101010101010001001110001
001001100100010111000001101000110110
001001001100011000011110110100001100
000100101001001110101001001110001100
000100100110110010110010100110000011
000100001010110101101101110001100000
000011100011001000011100101011100010
000010111000101001010001110010010101
000010011011010010000111011100010010

011111111111111100000000000000000000
101111110000000011111111000000000000
110111001100000011000000111111000000
111000101011000010110000110000111000
111000101010100001001100001100000111
111000010110010000100011001011100100
110110001000011000011010000010011110
110001000001101110010011001100100010
101110100000010100000001100101110011
101001000001101101101000100011010100
100111000001110000100100011000101101
100100010110001110010100101000010101
100010010110001101101000010100101010
100001101010001100000111010011001001
100000110101110001010010010110010001
100000011101110010001101100001001010
011100010001000100001101011110011000
011010000100101000110101110010000011
010101000110100001011001000001111001
010100110001001001100010101001001011
010010100100100110100110000101011100
010010000011010111001011110000000101
010001110000011000011100110101100100
010001011000010111100100000010110011
001100001101000101010110010001100110
001100000010111011000110100110101000
001011010011000010010000000111001111
001010011000101010001010011001110001
001001100100011011000001011000011110
001001001100010100111010101100001001
000101011010100000100011110100010110
000100101101001010101001000110100101
000100100010110110111000011011000010
000011100111000000001110101010110010
000010111000100101010001101010101100
000010001011011001110101001101010000

36
011111111111111100000000000000000000
101111110000000011111111000000000000
110111001100000011000000111111000000
111000101011000010110000110000111000
111000101010100001001100001100000111
111000010010011000100011101011000100
110110001000010100011010000010110110
110001000001101110011001100001000011
101110100000011000000001010101101011
101000000001111111000110010110010000
100111000001110000100100101000011101
100100010110001110010100011000100101
100010010110001101101000100100011010
100001101110000100000111000011011001
100001011101100000100011010100100110
100000110101110001011000001011101000
011100010101000000001101100110110001
011010000100100100110101011010001010
010101000010101001001011011000111000
010100110001000101000110110001001110
010010110000100110100010001101110001
010010000111010011010011000100001101
010001100100011000111100010101010100
010001011000011011100100000010101011
001101010010100010010000000111011110
001100001101001001110010001001010011
001011000011000101101000010011100101
001010001100101010001110100001101100
001001100100010111000001101000110110
001001011000010100011010111100001001
000100101001001110101001001110001100
000100100110110010101010110010000011
000100001010110101110101100101100000
000011100011001000010110101110100010
000010111000101001010001110010010101
000010011011010010001101011001010010

011111111111111100000000000000000000
101111110000000011111111000000000000
110111001100000011000000111111000000
111000101011000010110000110000111000
111000101010100001001100001100000111
111000010010011000100011101011000100
110110001000010100011010000010110110
110001000001101101011001100001100001
101110100000011000000001010101101011
101000000001111111000110010110010000
100111000001110000100100101000011101
100100010110001110010100011000100101
100010010110001101101000100100011010
100001101110000100000111000011011001
100001011101100000100011010100100110
100000110101110010011000001011001010
011100000101000100101101001110101000
011010010100100000010101110010010011
010101000010101010001011011000011010
010100110001000101000110110001001110
010010110000100110100010001101110001
010010000111010011010011000100001101
010001100100011000111100010101010100
010001011000011011100100000010101011
001101010010100001010000000111111100
001100001101001001110010001001010011
001011000011000110101000010011000111
001010001100101010001110100001101100
001001100100010111000001101000110110
001001011000010100011010111100001001
000100111001001010001001100110010101
000100100110110001101010110010100001
000100001010110110110101100101000010
000011100011001000010110101110100010
000010101000101101110001011010001100
000010011011010001001101011001110000

• in all of these graphs lambda = mu – trg787 Apr 28 '11 at 10:29
• it's the 3 simplest pairs (non-isomorphic) – trg787 Apr 28 '11 at 10:35
• what is that?!! and how do you know that there is at least one different path? – N27 Apr 28 '11 at 10:38
• I mean how do you know that the lists of all possible paths between every pair of nodes are identical? – N27 Apr 28 '11 at 10:47
• Anyway, sorry, I dont understand what you have tested or trying to say... My question was whether the 2 lists of all lengths of distinct paths between all pairs of nodes are NOT the same for 2 non-isomorphic graphs. – N27 Apr 28 '11 at 11:20