Using the graph representation with (node, [list of neighbours]), to show that two graphs are isomorphic it is sufficient to:

  • show that the vertices have the same degree and
  • for every pair of vertices with the same degree, the degrees of the nodes in their adjacency list must be the same.

The last point was a bit ambiguous, in the sense that in two graphs many vertices could have the same degree, but between two isomorphic graphs their is a bijective function (an exact one to one mapping) between them such that their adjacency list maps correctly.

My question is what's the proof behind this? Why is this sufficient? For me, this is not clear at all, because this is, overall, a local property and I can't understand how this generalizes to the whole graph.

If it's easier to track what I said on code...Prolog it's pretty verbose at this part.

:- dynamic p/2.
    delete(H2,L2,T2), % we generate a solution here
    P = ..[EQ, H1, H2],
    p(N1,_), !, fail.
    p(_,N2), !, fail.
  • $\begingroup$ Where is the statement in the first paragraph taken from? It is not clear how to implement this, which vertices do you compare? Are you simply comparing the degree sequences? In any case, this probably won't work since this results in a simple polynomial time algorithm for finding isomorphism. $\endgroup$
    – Ariel
    Aug 31, 2017 at 16:18
  • $\begingroup$ Sorry for being ambiguous on this part...the process of finding the mapping I spoke of is not polynomial...it's usually backtracking(in the code snippet posted, Prolog does backtracking for you behind the scenes). I am more interested in a math-like proof of the entire process. $\endgroup$ Aug 31, 2017 at 16:51
  • $\begingroup$ Could you write your algorithm in pseudocode for those of us who don't know prolog? $\endgroup$
    – Ariel
    Aug 31, 2017 at 16:57
  • $\begingroup$ I don't think this is correct since it seems to imply a polynomial-time algorithm for GI, which is not known to exist. I doubt it would be this easy! $\endgroup$
    – Raphael
    Aug 31, 2017 at 16:57
  • $\begingroup$ The program is definitely not polynomial because Prolog uses an execution tree behind the scenes that does backtracking automatically. The program above is not polynomial because the unification process is intrinsically non-polynomial in this case. I will come back with pseudocode too (_: $\endgroup$ Aug 31, 2017 at 17:08

1 Answer 1


This method fails on regular graphs. For example, it fails on the following two graphs: the hexagon, and two disconnected triangles.

More generally, if you continue to explore neighbors' neighbors and so on, you get the 1-dimensional Weisfeiler–Lehman method. If you start with $k$-tuples of vertices, you get the $k$-dimensional Weisfeiler–Lehman method. Cai, Fürer and Immerman proved in An optimal lower bound on the number of variables for graph identification that there exist non-isomorphic graphs on $n$ vertices which fail to be distinguished by the $k$-dimensional Weisfeiler–Lehman method unless $k = \Omega(n)$. Since the running time of the method in the worst case is asymptotically $n^{k+1}$, this shows that the Weisfeiler–Lehman method doesn't yield a subexponential time algorithm for graph isomorphism.

For more on the Weisfeiler–Lehman method, check a paper of Douglas, or the recent work of Neuen and Schweitzer.

  • $\begingroup$ Thank you very much! It is the first time I hear about them, but their analysis is the thing I was looking for. $\endgroup$ Aug 31, 2017 at 18:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.