Edit distance between two graphs

10,609

Solution 1

I think graph edit distance is the measure that you were looking for.

Graph edit distance measures the minimum number of graph edit operations to transform one graph to another, and the allowed graph edit operations includes:

  • Insert/delete an isolated vertex
  • Insert/delete an edge
  • Change the label of a vertex/edge (if labeled graphs)

However, computing the graph edit distance between two graphs is NP-hard. The most efficient algorithm for computing this is an A*-based algorithm, and there are other sub-optimal algorithms.

Solution 2

You should look at the paper A survey of graph edit distance

Solution 3

For a general graph it is a NP-complete problem as others mentioned in their answer. But for tree graph there are well known polynomial algorithms. May be most famous of them is "Zhang Shasha" algorithm which was published in 1989.

Solution 4

Note:

The Levenshtein distance (or edit distance) is between two strings

But in Graph you should search between at least N! position that you find Identity of each edge and vertex. You can compare between two graph by unique index easily,But The master question is define identity for each vertex and edge.this question (find identity for each vertex and edge in two graph that they can to transform ) is very hard and was called isomorphism problem (NP-Complete). You can search about isomorphism graph.

Share:
10,609

Related videos on Youtube

linello
Author by

linello

Currently I'm scientific software developer with proficiency in C/C++ with their related technologies Boost, STL, Qt, Python, computer graphics, OpenGL, Mathematica, MatLab, Bash scripting, NI Labview, LATEX, CMake, CUDA.

Updated on June 06, 2022

Comments

  • linello
    linello almost 2 years

    I'm just wondering if, like for strings where we have the Levenshtein distance (or edit distance) between two strings, is there something similar for graphs?

    I mean, a scalar measure that identifies the number of atomic operations (node and edges insertion/deletion) to transform a graph G1 to a graph G2.

  • Jason
    Jason over 8 years
    @ivotro these slides introduce the basic concepts of GED, orion.math.iastate.edu/rymartin/talks/EditDist/…
  • Vishrant
    Vishrant over 6 years
    @jason.Z these papers/ PPT talks about the theory of GED, is there any implementation based on latest suggestions in GED?