Fast approximate maximum common subgraph computation
Mathias Fuchs, Kaspar Riesen · Pattern Recognition Letters · 2025
The computation of the maximum common subgraph (MCS) is one of the most prevalent problems in graph based data science. However, state-of-the-art algorithms for exact MCS computation have exponential time complexity. Actually, finding the MCS of two general graphs is an NP-complete problem, and thus, the definition of an exact algorithm with polynomial time complexity is only possible if P = NP. In the present paper, we thoroughly compare a novel concept called matching-graph — which is basically defined as the stable core of pairs of graphs — to the MCS. In particular, we research whether these matching-graphs — computable in polynomial time — offer a viable approximation for the MCS. The contribution of this paper is twofold. First, we demonstrate that for specific graphs a matching-graph equals the maximum common edge subgraph and thus its size builds an upper bound of the size of the maximum common induced subgraph. Second, in an experimental evaluation on seven graph datasets, we empirically confirm that the proposed matching-graph computation outperforms existing MCS (approximation) algorithms in terms of both computation time and classification accuracy. • The matching-graph (MG) is a graph that captures the similarity core of two graphs. • We propose to use the MG to approximate the MCS in polynomial time. • Given graphs with labeled nodes and unlabeled edges, the approximation equals MCES. • We show that the MG can be successfully used in a distance-based classifier.