1

Is there a $O(n^2)$ algorithm to resolve isomorphism between two weighted $n$-vertex graphs? This is a much easier problem than graph isomorphism.

Basically take an real edge weight set $\{w_1,\dots,w_s\}$

All weights on the graph edges are from this set.

5 Answers5

7

This on contrary appears to be a problem of greater difficulty than graph isomorphism. If you had a polynomial time solution to this problem,you can reduce graph isomorphism to it by keeping each edge weight say equal to some constant $c$. Also graph isomorphism is not known to have a polynomial time solution. It is a still an open question.

advocateofnone
  • 3,179
  • 1
  • 27
  • 44
5

As sasha mentions, your problem is actually a generalization of the usual graph isomorphism. To put it differently, graph isomorphism is a special case of your problem, in which all weights are the same. Therefore your problem can only be more difficult.

On the other hand, it is easy to reduce your problem to the usual graph isomorphism. Assuming that only edges have weights, the idea is to split each edge into a path of length two, and to attach to the middle node a clique whose size depends on the weight (we only need that different weights have different clique sizes, and that the cliques be large enough). So your problem is GI-complete, i.e., equivalent to graph isomorphism.

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514
3

As others pointed out already, graph isomorphism is a special case of weighted graph isomorphism, where all edges have the same weight. And on the other hand, weighted graph isomorphism can be reduced to graph isomorphism.

In fact, most isomorphism problems for finite structures turn out to be essentially equivalent to graph isomorphism. A theoretical construction showing this which tries to keep the valence of the resulting graphs as small as possible is given in Graph Isomorphism, General Remarks by Gary L. Miller. The presentation Practical Graph Isomorphism, II by Brendan McKay and Adolfo Piperno uses a more practical approach to convey the same message. They first highlight the Ubiquity of graph isomorphism with concrete examples, and then mention Permutation equivalence of linear codes, which is a rare example of a finite structure whose isomorphism problem is not known to be reducible to graph isomorphism. Very efficient practical reductions of the mentioned examples to the (vertex) colored (di)graph isomorphism problem solved by nauty and Traces can be found in section "14 Variations" of the nauty and Traces User’s Guide (Version 2.5):

If the original graph has $n$ vertices and $k$ colours, the new graph has $O(n \log k)$ vertices. This can be improved to $O(n \sqrt{\log k})$ vertices by also using edges that are not horizontal, but this needs care.

Thomas Klimpel
  • 5,440
  • 29
  • 69
3

The problem is in fact easier than graph isomorphism for a directed graph when the weights are all distinct. I wonder if this was the original intent of the question.

For distinct-weighted directed graphs A and B with same number of vertices $n$ and edges $e$, do the following:

  • Sort the edge weights of A and B in decreasing order.
  • Maintain a labeling $\theta$ of vertices of graph B, initialized to the empty set $\phi$. We will fill this labeling in our algorithm and check if we get any contradictory labels. Let us call the label of a vertex $u$ under the labelling $\theta$, $\theta(u)$
  • iterate over edges $e_i=(u_i, v_i)$ in A and corresponding edge $e_i' = (u_i', v_i')$ in B in the sorted order
    • if $weight(e_i) \neq weight(e_i')$ then graphs are not isomorphic. Terminate
    • if $\theta(u_i') == \phi$, then $\theta := \theta\ \cup (u_i', u_i)$
    • if $\theta(v_i') == \phi$, then $\theta := \theta\ \cup (v_i', v_i)$
    • if $\theta(u_i') \neq \phi$ and $\theta(u_i') \neq u_i$ then graphs are not isomorphic. Terminate
    • if $\theta(v_i') \neq \phi$ and $\theta(v_i') \neq v_i$ then graphs are not isomorphic. Terminate
  • if not terminated yet, then graphs are isomorphic. Terminate and enjoy a cup of tea :-)

The running time is $O(e.log(e))$ for sorting edges and $e$ for the single pass over the edges.

The problem is not as useless as it sounds. For example, directed, distinct edge-weighted graph isomorphism can be used to find out if two given Bayesian Networks are isomorphic or not. This can be used to transfer knowledge from one domain to another.

EDIT: I took a look at some comments by the OP and it looks like he is talking about a probabilistic case. So my answer does not apply. I'll leave it here for reference.

0

For the unweighted case, it has recently been shown that there is a quasi-polynomial time algorithm. It is a fresh of the oven result though, you can find a sort of non-expert kind of friendly description of it here or here. And the original paper and even a video of the talk in which Lazlo Babai presented his results.

As mentioned in other answers, it is a hard problem and I have never implemented the solution myself.

Edit: I am not very familiar with Babai's new algorithm and I cannot tell if using a weighted graph is feasible.

Paco
  • 101
  • 1