Proving the edit distance between graphs with no edges is a metric

367 Views Asked by At

The problem is finding the minimum edit distance between two graphs with no edges, considering there might be different costs for adding, removing or replacing vertices.

I was told this distance is a metric, and there is a easy way to prove it. Is it so? How it can be done?

1

There are 1 best solutions below

0
On

I will call the distance between two graphs G and H, d(G, H).

  1. For any graph G, d(G, G) = 0. As long as all the costs are strictly positive, then for any G != H, d(G, H) > 0. So non-negativity is satisfied.

  2. As long as the cost of removing a vertex is the same as the cost of adding a vertex, for any two graphs G, H, d(G, H) = d(H, G). So symmetry is satisfied.

  3. Finally, for any three graphs G, H, K, d(G, K) is at most d(G, H) + d(H, K) because one could edit G to K by first editing it to H.

The above criteria define a metric.