1

Hi all,

I would like to know if there is a way to compute some measure of similarity between two ordinary graphs with weighted edges. Graphs do not share vertices and can differ in number of vertices and edges.

Any hints, suggestions and thoughts are highly appreciated.

Best, Jozef

flag
A weighted graph is not much different than a real (symmetric if you are not considering digraphs) matrix. A possible candidate is thus using any of the available matrix norms. – Gjergji Zaimi Sep 10 2010 at 13:43
@Gjergji - what if the graphs have different numbers of vertices? – Darsh Ranjan Sep 10 2010 at 19:36
2 
I don't think you can expect to find one good measure of similarity for graphs. Whatever measures you can come up with will depend on which application you have in mind. – Thierry Zell Sep 11 2010 at 0:22
@Darsh - add empty vertices. – Gjergji Zaimi Sep 11 2010 at 1:03

4 Answers

4

If you view the weights as edge lengths then you can view each graph as a metric space, and then use the Gromov-Hausdorff distance between the two metric spaces. This may not be at all suitable for your application but it has been very useful in my own research.

link|flag
1 
It might not work very well if the weights do not give you a metric space: what about the triangle inequality? – Thierry Zell Sep 11 2010 at 0:17
1 
The weights (assuming they are non-negative) always give you a metric space. The definition of the distance between two vertices is the total weight on the lightest path between them. – Louigi Addario-Berry Sep 11 2010 at 1:13
1

If all weights of edges are strictly positive, interpreting them as lengths and considering the Gromov-Hausdorff distance (see http://en.wikipedia.org/wiki/Gromov%E2%80%93Hausdorff_convergence) is perhaps a good candidate. If there are negative weights, replace them by exponentials first.

link|flag
1

Comparing two graph structures with the same number of vertices and edges to see if they are equivalent would be the graph isomorphism problem. The graph isomorphism problem is known to be NP in complexity, but it is not known if it is NP-complete nor is it known to be solvable in polynomial time.

Comparing two graph structures with different numbers of edges and vertices would be a slightly bigger problem. Call the graph with the smaller number of vertices $G_1$ and the graph with the larger number of vertices $G_2$. Now you have to search to see if $G_1$ is isomorphic or similar to a subset of $G_2$. Depending on the relative sizes of the graphs, this could take a long time to evaluate.

If you already has a similarity metric defined for two graphs with the same number of vertices, e.g. $d(G_a,G_b)$, where $|V_a|=|V_b|$, then you could proceed as follows.

One way to attack the problem is to take the smaller graph as the template and see if you can overlay it onto the larger graph by taking a subset of the vertices of $G_2$, call it $H_n$ where $n$ can be one of the $\binom{|V_2|}{|V_1|}$ ways of picking a subgraph of $G_2$ with the same number of vertices as $G_1$. $|V_1|$= the number of vertices in $G_1$, and $|V_2|$= the number of vertices in $G_2$ in this case.

One similarity metric to use to compare two graphs with the same number of vertices would be to apply a mapping between vertices between $G_1$ and $G_2$, e.g. {$m: V_{1,a} \to V_{2,b}$}.

Then add up the number of coincident edges: for each edge in $G_1$ which connects $V_{1,i}$ and $V_{1,j}$, find the two corresponding vertices in $G_2$ , $V_{2,m(a)}$ and $V_{2,m(b)} $,and see if there is a corresponding edge is $G_2$ between these corresponding vertices.

link|flag
0

It migth be you find some useful matters in the following article:

A metric on the space of weigthed graphs, Hamed Daneshpajouh, Hamid Reza Daneshpajouh, Farzad Didehvar.

Rigth now you can find it in arxive.

link|flag

Your Answer

Get an OpenID
or

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