ArticleslgStudy

computer science

Graph edit distance

Graph edit distance is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Graph edit distance rather than just read about it. In short: In mathematics and computer science, graph edit distance (GED) is a measure of similarity (or dissimilarity) between two graphs. The concept of graph edit distance was first formalized mathematically by Alberto Sanfeliu and King-Sun Fu in 1983.

Graph edit distance — main illustration
Graph edit distance — illustration

Key takeaways

  • Graph edit distance belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Graph edit distance to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Graph edit distance from memory before moving on to harder problems.

Reference excerpt

In mathematics and computer science, graph edit distance (GED) is a measure of similarity (or dissimilarity) between two graphs. The concept of graph edit distance was first formalized mathematically by Alberto Sanfeliu and King-Sun Fu in 1983. A major application of graph edit distance is in inexact graph matching, such as error-tolerant pattern recognition in machine learning. The graph edit distance between two graphs is related to the string edit distance between strings. With the interpretation of strings as connected, directed acyclic graphs of maximum degree one, classical definitions of edit distance such as Levenshtein distance, Hamming distance and Jaro–Winkler distance may be interpreted as graph edit distances between suitably constrained graphs. Likewise, graph edit distance is also a generalization of tree edit distance between rooted trees.

Formal definitions and properties The mathematical definition of graph edit distance is dependent upon the definitions of the graphs over which it is defined, i.e. whether and how the vertices and edges of the graph are labeled and whether the edges are directed. Generally, given a set of graph edit operations (also known as elementary graph operations), the graph edit distance between two graphs g 1 {\displaystyle g_{1}} and g 2 {\displaystyle g_{2}} , written as G E D ( g 1 , g 2 ) {\displaystyle GED(g_{1},g_{2})} can be defined as

G E D ( g 1 , g 2 ) = min ( e 1 , . . . , e k ) ∈ P ( g 1 , g 2 ) ∑ i = 1 k c ( e i ) {\displaystyle GED(g_{1},g_{2})=\min _{(e_{1},...,e_{k})\in {\mathcal {P}}(g_{1},g_{2})}\sum _{i=1}^{k}c(e_{i})}

where P ( g 1 , g 2 ) {\displaystyle {\mathcal {P}}(g_{1},g_{2})} denotes the set of edit paths transforming g 1 {\displaystyle g_{1}} into (a graph isomorphic to) g 2 {\displaystyle g_{2}} and c ( e ) ≥ 0 {\displaystyle c(e)\geq 0} is the cost of each graph edit operation e {\displaystyle e} . The set of elementary graph edit operators typically includes:

vertex insertion to introduce a single new labeled vertex to a graph. vertex deletion to remove a single (often disconnected) vertex from a graph. vertex substitution to change the label (or color) of a given vertex. edge insertion to introduce a new colored edge between a pair of vertices. edge deletion to remove a single edge between a pair of vertices. edge substitution to change the label (or color) of a given edge. Additional, but less common operators, include operations such as edge splitting that introduces a new vertex into an edge (also creating a new edge), and edge contraction that eliminates vertices of degree two between edges (of the same color). Although such complex edit operators can be defined in terms of more elementary transformations, their use allows finer parameterization of the cost function c {\displaystyle c} when the operator is cheaper than the sum of its constituents. A deep analysis of the elementary graph edit operators is presented in And some methods have been presented to automatically deduce these elementary graph edit operators. And some algorithms learn these costs online:

Applications Graph edit distance finds applications in handwriting recognition, fingerprint recognition and cheminformatics.

Algorithms and complexity Exact algorithms for computing the graph edit distance between a pair of graphs typically transform the problem into one of finding the minimum cost edit path between the two graphs. The computation of the optimal edit path is cast as a pathfinding search or shortest path problem, often implemented as an A* search algorithm. In addition to exact algorithms, a number of efficient approximation algorithms are also known. Most of them have cubic computational time

however, the runtime of at least one algorithm is linear in the number of nodes while still being cubic in the node degree. Despite the above algorithms sometimes working well in practice, in general the problem of computing graph edit distance is NP-hard (for a proof that's available online, see Section 2 of Zeng et al.), and is even hard to approximate (formally, it is APX-hard).

… excerpt ends here. Continue reading the full article.

Illustrations

Graph edit distance: At first glance, the GED (graph edit distance) may appear to be 7, removing 3 edges, adding the yellow vertex, and adding edges between it and the 3 other vertices. However, the optimal set of operations would be to remove the edge between 2 colors of choice (for example, green and blue), change the third (red) to yellow, add a vertex of the now missing color (red), and connect it to the newly yellow vertex, for a GED of 4.
At first glance, the GED (graph edit distance) may appear to be 7, removing 3 edges, adding the yellow vertex, and adding edges between it and the 3 other vertices. However, the optimal set of operations would be to remove the edge between 2 colors of choice (for example, green and blue), change the third (red) to yellow, add a vertex of the now missing color (red), and connect it to the newly yellow vertex, for a GED of 4.

Worked examples

Example 1 — a first encounter with Graph edit distance

Start with the simplest possible case. Write down what Graph edit distance claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Graph edit distance before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Graph edit distance ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Graph edit distance

In research
Graph edit distance appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Graph edit distance in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Graph edit distance is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computational problems in graph theory, Distance, Graph algorithms, so understanding it makes those chapters shorter.
In everyday life
Look for Graph edit distance outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Graph edit distance” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Graph edit distance in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Graph edit distance means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Graph edit distance out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Graph edit distance in simple terms?

In mathematics and computer science, graph edit distance (GED) is a measure of similarity (or dissimilarity) between two graphs. The concept of graph edit distance was first formalized mathematically by Alberto Sanfeliu and King-Sun Fu in 1983.

Why does Graph edit distance matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Graph edit distance?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Graph edit distance.

Tags

  • Computational problems in graph theory
  • Distance
  • Graph algorithms
  • Graph theory

Keep exploring