Efficient Implementation of Color Coding Algorithm for Subgraph Isomorphism Problem
Josef Malík, Ondřej Suchý, Tomáš Valla
备注:
Extended abstract of this paper will appear in the proceedings of the Special Event on Analysis of Experimental Algorithms, SEA2 2019, Lecture Notes in Computer Science, Springer
We consider the subgraph isomorphism problem where, given two graphs G (source graph) and F (pattern graph), one is to decide whether there is a (not necessarily induced) subgraph of G isomorphic to F. While many practical heuristic algorithms have been developed for the problem, as pointed out by McCreesh et al. [JAIR 2018], for each of them there are rather small instances which they cannot cope. Therefore, developing an alternative approach that could possibly cope with these hard instances would be of interest.
A seminal paper by Alon, Yuster and Zwick [J. ACM 1995] introduced the color coding approach to solve the problem, where the main part is a dynamic programming over color subsets and partial mappings. As with many exponential-time dynamic programming algorithms, the memory requirements constitute the main limiting factor for its usage. Because these requirements grow exponentially with the treewidth of the pattern graph, all existing implementations based on the color coding principle restrict themselves to specific pattern graphs, e.g., paths or trees. In contrast, we provide an efficient implementation of the algorithm significantly reducing its memory requirements so that it can be used for pattern graphs of larger treewidth. Moreover, our implementation not only decides the existence of an isomorphic subgraph, but it also enumerates all such subgraphs (or given number of them).
We provide an extensive experimental comparison of our implementation to other available solvers for the problem.
We solve the subgraph isomorphism problem in planar graphs in linear time, for any pattern of constant size. Our results are based on a technique of partitioning the planar graph into pieces of small tree-width, and applying dynamic programming within each piece. The same methods can be used to solve other planar graph problems including connectivity, diameter, girth, induced subgraph isomorphism, and shortest paths.
Many real world networks are considered temporal networks, in which the chronological ordering of the edges has importance to the meaning of the data. Performing temporal subgraph matching on such graphs requires the edges in the subgraphs to match the order of the temporal graph motif we are searching for. Previous methods for solving this rely on the use of static subgraph matching to find potential matches first, before filtering them based on edge order to find the true temporal matches. We present a new algorithm for temporal subgraph isomorphism that performs the subgraph matching direct…
We study Subgraph Isomorphism on graph classes defined by a fixed forbidden graph. Although there are several ways for forbidding a graph, we observe that it is reasonable to focus on the minor relation since other well-known relations lead to either trivial or equivalent problems. When the forbidden minor is connected, we present a near dichotomy of the complexity of Subgraph Isomorphism with respect to the forbidden minor, where the only unsettled case is $P_{5}$, the path of five vertices. We then also consider the general case of possibly disconnected forbidden minors. We show fixed-parame…
Subgraph Isomorphism is a very basic graph problem, where given two graphs $G$ and $H$ one is to check whether $G$ is a subgraph of $H$. Despite its simple definition, the Subgraph Isomorphism problem turns out to be very broad, as it generalizes problems such as Clique, $r$-Coloring, Hamiltonicity, Set Packing and Bandwidth. However, for all of the mentioned problems $2^{\mathcal{O}(n)}$ time algorithms exist, so a natural and frequently asked question in the past was whether there exists a $2^{\mathcal{O}(n)}$ time algorithm for Subgraph Isomorphism. In the monograph of Fomin and Kratsch [Sp…
We prove that unless Exponential Time Hypothesis (ETH) fails, deciding if there is a homomorphism from graph $G$ to graph $H$ cannot be done in time $|V(H)|^{o(|V(G)|)}$. Combined with the reduction of Cygan, Pachocki, and Socała, our result rules out (subject to ETH) a possibility of $|V(G)|^{o(|V(G)|)}$-time algorithm deciding if graph $H$ is a subgraph of $G$. For both problems our lower bounds asymptotically match the running time of brute-force algorithms trying all possible mappings of one graph into another. Thus, our work closes the gap in the known complexity of these fundamental prob…
The big graph database model provides strong modeling for complex applications and efficient querying. However, it is still a big challenge to find all exact matches of a query graph in a big graph database, which is known as the subgraph isomorphism problem. The current subgraph isomorphism approaches are built on Ullmann's idea of focusing on the strategy of pruning out the irrelevant candidates. Nevertheless, the existing pruning techniques need much more improvement to efficiently handle complex queries. Moreover, many of those existing algorithms need large indices requiring extra memory …
The problem of Subgraph Isomorphism is defined as follows: Given a pattern H and a host graph G on n vertices, does G contain a subgraph that is isomorphic to H? Eppstein [SODA 95, J'GAA 99] gives the first linear time algorithm for subgraph isomorphism for a fixed-size pattern, say of order k, and arbitrary planar host graph, improving upon the O(n^\sqrt{k})-time algorithm when using the ``Color-coding'' technique of Alon et al [J'ACM 95]. Eppstein's algorithm runs in time k^O(k) n, that is, the dependency on k is superexponential. We solve an open problem posed in Eppstein's paper and improv…
Graphs are widely used to model complicated data semantics in many application domains. In this paper, two novel and efficient algorithms Fast-ON and Fast-P are proposed for solving the subgraph isomorphism problem. The two algorithms are based on Ullman algorithm [Ullmann 1976], apply vertex-at-a-time matching manner and path-at-a-time matching manner respectively, and use effective heuristics to cut the search space. Comparing to the well-known algorithms, Fast-ON and Fast-P achieve up to 1-4 orders of magnitude speed-up for both dense and sparse graph data.
The process of identifying stars is integral toward stellar based orientation determination in spacecraft. Star identification involves matching points in an image of the sky with stars in an astronomical catalog. A unified framework for identification was created and used to analyze six variations of methods based on their approach to star set identification, obtaining a single image to catalog star set match, and uniquely mapping each star in a image star set to a catalog star set. Each method was presented an artificial image, and aspects that were interchangeable among each process were no…
The kTree problem is a special case of Subgraph Isomorphism where the pattern graph is a tree, that is, the input is an $n$-node graph $G$ and a $k$-node tree $T$, and the goal is to determine whether $G$ has a subgraph isomorphic to $T$. We provide evidence that this problem cannot be computed significantly faster than $2^{k} \textsf{poly}(n)$, which matches the fastest algorithm known for this problem by Koutis and Williams [ICALP 2009 and TALG 2016]. Specifically, we show that if kTree can be solved in time $(2-\varepsilon)^k \textsf{poly}(n)$ for some constant $\varepsilon>0$, then Set Cov…
We present the first parallel fixed-parameter algorithm for subgraph isomorphism in planar graphs, bounded-genus graphs, and, more generally, all minor-closed graphs of locally bounded treewidth. Our randomized low depth algorithm has a near-linear work dependency on the size of the target graph. Existing low depth algorithms do not guarantee that the work remains asymptotically the same for any constant-sized pattern. By using a connection to certain separating cycles, our subgraph isomorphism algorithm can decide the vertex connectivity of a planar graph (with high probability) in asymptotic…
We study the complexity of the Graph Isomorphism problem on graph classes that are characterized by a finite number of forbidden induced subgraphs, focusing mostly on the case of two forbidden subgraphs. We show hardness results and develop techniques for the structural analysis of such graph classes, which applied to the case of two forbidden subgraphs give the following results: A dichotomy into isomorphism complete and polynomial-time solvable graph classes for all but finitely many cases, whenever neither of the forbidden graphs is a clique, a pan, or a complement of these graphs. Further …
A new approach of graph matching is introduced in this paper, which efficiently solves the problem of graph isomorphism and subgraph isomorphism. In this paper we are introducing a new approach called SubGraD, for query graph detection in source graph. Firstly consider the model graph (query graph) and make the possible sets called model sets starting from the chosen initial node or starter. Similarly, for the source graph (reference graph), all the possible sets called reference sets could be made. Our aim is to make the reference set on the basis of the model set. If it is possible to make t…
In this paper we study a natural generalization of both {\sc $k$-Path} and {\sc $k$-Tree} problems, namely, the {\sc Subgraph Isomorphism} problem. In the {\sc Subgraph Isomorphism} problem we are given two graphs $F$ and $G$ on $k$ and $n$ vertices respectively as an input, and the question is whether there exists a subgraph of $G$ isomorphic to $F$. We show that if the treewidth of $F$ is at most $t$, then there is a randomized algorithm for the {\sc Subgraph Isomorphism} problem running in time $\cO^*(2^k n^{2t})$. To do so, we associate a new multivariate {Homomorphism polynomial} of degre…
In the Maximum Common Induced Subgraph problem (henceforth MCIS), given two graphs $G_1$ and $G_2$, one looks for a graph with the maximum number of vertices being both an induced subgraph of $G_1$ and $G_2$. MCIS is among the most studied classical NP-hard problems. It remains NP-hard on many graph classes including forests. In this paper, we study the parameterized complexity of MCIS. As a generalization of \textsc{Clique}, it is W[1]-hard parameterized by the size of the solution. Being NP-hard even on forests, most structural parameterizations are intractable. One has to go as far as param…
The rise of graph analytic systems has created a need for ways to measure and compare the capabilities of these systems. Graph analytics present unique scalability difficulties. The machine learning, high performance computing, and visual analytics communities have wrestled with these difficulties for decades and developed methodologies for creating challenges to move these communities forward. The proposed Subgraph Isomorphism Graph Challenge draws upon prior challenges from machine learning, high performance computing, and visual analytics to create a graph challenge that is reflective of ma…
We generalize the structure theorem of Robertson and Seymour for graphs excluding a fixed graph $H$ as a minor to graphs excluding $H$ as a topological subgraph. We prove that for a fixed $H$, every graph excluding $H$ as a topological subgraph has a tree decomposition where each part is either "almost embeddable" to a fixed surface or has bounded degree with the exception of a bounded number of vertices. Furthermore, we prove that such a decomposition is computable by an algorithm that is fixed-parameter tractable with parameter $|H|$. We present two algorithmic applications of our structure …
In the Set Cover problem, the input is a ground set of $n$ elements and a collection of $m$ sets, and the goal is to find the smallest sub-collection of sets whose union is the entire ground set. The fastest algorithm known runs in time $O(mn2^n)$ [Fomin et al., WG 2004], and the Set Cover Conjecture (SeCoCo) [Cygan et al., TALG 2016] asserts that for every fixed $\varepsilon>0$, no algorithm can solve Set Cover in time $2^{(1-\varepsilon)n}poly(m)$, even if set sizes are bounded by $Δ=Δ(\varepsilon)$. We show strong connections between this problem and kTree, a special case of Subgraph Isomor…
The Subgraph Isomorphism problem is of considerable importance in computer science. We examine the problem when the pattern graph H is of bounded treewidth, as occurs in a variety of applications. This problem has a well-known algorithm via color-coding that runs in time $O(n^{tw(H)+1})$ [Alon, Yuster, Zwick'95], where $n$ is the number of vertices of the host graph $G$. While there are pattern graphs known for which Subgraph Isomorphism can be solved in an improved running time of $O(n^{tw(H)+1-\varepsilon})$ or even faster (e.g. for $k$-cliques), it is not known whether such improvements are…
The problem of counting occurrences of query graphs in a large data graph, known as subgraph counting, is fundamental to several domains such as genomics and social network analysis. Many important special cases (e.g. triangle counting) have received significant attention. Color coding is a very general and powerful algorithmic technique for subgraph counting. Color coding has been shown to be effective in several applications, but scalable implementations are only known for the special case of {\em tree queries} (i.e. queries of treewidth one). In this paper we present the first efficient dis…
Hierarchical structure and repetition are prevalent in graphs originating from nature or engineering. These patterns can be represented by a class of parametric-structure graphs, which are defined by templates that generate structure by way of repeated instantiation. We propose a class of parametric graph templates that can succinctly represent a wide variety of graphs. Using parametric graph templates, we develop structurally-parametric algorithm variants of maximum flow, minimum cut, and tree subgraph isomorphism. Our algorithms are polynomial time for maximum flow and minimum cut and are fi…
Given two graphs $H$ and $G$, the Subgraph Isomorphism problem asks if $H$ is isomorphic to a subgraph of $G$. While NP-hard in general, algorithms exist for various parameterized versions of the problem: for example, the problem can be solved (1) in time $2^{O(|V(H)|)}\cdot n^{O(\tw(H))}$ using the color-coding technique of Alon, Yuster, and Zwick; (2) in time $f(|V(H)|,\tw(G))\cdot n$ using Courcelle's Theorem; (3) in time $f(|V(H)|,\genus(G))\cdot n$ using a result on first-order model checking by Frick and Grohe; or (4) in time $f(\maxdeg(H))\cdot n^{O(\tw(G)})$ for connected $H$ using the…
Given two graphs $G$ and $H$, we say that $G$ contains $H$ as an induced minor if a graph isomorphic to $H$ can be obtained from $G$ by a sequence of vertex deletions and edge contractions. We study the complexity of Graph Isomorphism on graphs that exclude a fixed graph as an induced minor. More precisely, we determine for every graph $H$ that Graph Isomorphism is polynomial-time solvable on $H$-induced-minor-free graphs or that it is GI-complete. Additionally, we classify those graphs $H$ for which $H$-induced-minor-free graphs have bounded clique-width. These two results complement similar …
For any fixed graph $G$, the subgraph isomorphism problem asks whether an $n$-vertex input graph has a subgraph isomorphic to $G$. A well-known algorithm of Alon, Yuster and Zwick (1995) efficiently reduces this to the "colored" version of the problem, denoted $G$-$\mathsf{SUB}$, and then solves $G$-$\mathsf{SUB}$ in time $O(n^{tw(G)+1})$ where $tw(G)$ is the treewidth of $G$. Marx (2010) conjectured that $G$-$\mathsf{SUB}$ requires time $Ω(n^{\mathrm{const}\cdot tw(G)})$ and, assuming the Exponential Time Hypothesis, proved a lower bound of $Ω(n^{\mathrm{const}\cdot emb(G)})$ for a certain gr…
An $H$-graph is one representable as the intersection graph of connected subgraphs of a suitable subdivision of a fixed graph $H$, introduced by Biró, Hujter and Tuza (1992). An $H$-graph is proper if the representing subgraphs of $H$ can be chosen incomparable by the inclusion. In this paper, we focus on the isomorphism problem for $S_d$-graphs and $T$-graphs, where $S_d$ is the star with $d$ rays and $T$ is an arbitrary fixed tree. Answering an open problem of Chaplick, Töpfer, Voborn\'ık and Zeman (2016), we provide an FPT-time algorithm for testing isomorphism and computing the automorphis…
Symmetry plays a major role in subgraph matching both in the description of the graphs in question and in how it confounds the search process. This work addresses how to quantify these effects and how to use symmetries to increase the efficiency of subgraph isomorphism algorithms. We introduce rigorous definitions of structural equivalence and establish conditions for when it can be safely used to generate more solutions. We illustrate how to adapt standard search routines to utilize these symmetries to accelerate search and compactly describe the solution space. We then adapt a state-of-the-a…
In recent years many algorithms have been developed for finding patterns in graphs and networks. A disadvantage of these algorithms is that they use subgraph isomorphism to determine the support of a graph pattern; subgraph isomorphism is a well-known NP complete problem. In this paper, we propose an alternative approach which mines tree patterns in networks by using subgraph homomorphism. The advantage of homomorphism is that it can be computed in polynomial time, which allows us to develop an algorithm that mines tree patterns in arbitrary graphs in incremental polynomial time. Homomorphism …
An $H$-graph is an intersection graph of connected subgraphs of a suitable subdivision of a fixed graph $H$. Many important classes of graphs, including interval graphs, circular-arc graphs, and chordal graphs, can be expressed as $H$-graphs, and, in particular, every graph is an $H$-graph for a suitable graph $H$. An $H$-graph is called proper if it has a representation where no subgraph properly contains another. We consider the recognition and isomorphism problems for proper $U$-graphs where $U$ is a unicylic graph. We prove that testing whether a graph is a (proper) $U$-graph, for some $U$…
The graph isomorphism is to determine whether two graphs are isomorphic. A closely related problem is automorphism detection, where an isomorphism between two graphs is a bijection between their vertex sets that preserves adjacency, and an automorphism is an isomorphism from a graph to itself. Applications of graph isomorphism/automorphism include database indexing, network simplification, network anonymization. By graph automorphism, we deal with symmetric subgraph matching (SSM), which is to find all subgraphs that are symmetric to a given subgraph in G. An application of SSM is to identify …
We devise an algorithm that approximately computes the number of paths of length $k$ in a given directed graph with $n$ vertices up to a multiplicative error of $1 \pm \varepsilon$. Our algorithm runs in time $\varepsilon^{-2} 4^k(n+m) \operatorname{poly}(k)$. The algorithm is based on associating with each vertex an element in the exterior (or, Grassmann) algebra, called an extensor, and then performing computations in this algebra. This connection to exterior algebra generalizes a number of previous approaches for the longest path problem and is of independent conceptual interest. Using this…
Schietgat, Ramon and Bruynooghe proposed a polynomial-time algorithm for computing a maximum common subgraph under the block-and-bridge preserving subgraph isomorphism (BBP-MCS) for outerplanar graphs. We show that the article contains the following errors: (i) The running time of the presented approach is claimed to be $\mathcal{O}(n^{2.5})$ for two graphs of order $n$. We show that the algorithm of the authors allows no better bound than $\mathcal{O}(n^4)$ when using state-of-the-art general purpose methods to solve the matching instances arising as subproblems. This is even true for the spe…
We study the problem of finding a copy of a specific induced subgraph on inhomogeneous random graphs with infinite variance power-law degrees. We provide a fast algorithm that finds a copy of any connected graph $H$ on a fixed number of $k$ vertices as an induced subgraph in a random graph with $n$ vertices. By exploiting the scale-free graph structure, the algorithm runs in $O(n k)$ time for small values of $k$. As a corollary, this shows that the induced subgraph isomorphism problem can be solved in time $O(nk)$ for the inhomogeneous random graph. We test our algorithm on several real-world …
Unigraphs are graphs uniquely determined by their own degree sequence up to isomorphism. There are many subclasses of unigraphs such as threshold graphs, split matrogenic graphs, matroidal graphs, and matrogenic graphs. Unigraphs and these subclasses are well studied in the literature. Nevertheless, there are few results on superclasses of unigraphs. In this paper, we introduce two types of generalizations of unigraphs: $k$-unigraphs and $k$-strong unigraphs. We say that a graph $G$ is a $k$-unigraph if $G$ can be partitioned into $k$ unigraphs. $G$ is a $k$-strong unigraph if not only each su…
Recently, great efforts have been dedicated to researches on the management of large scale graph based data such as WWW, social networks, biological networks. In the study of graph based data management, node disjoint subgraph homeomorphism relation between graphs is more suitable than (sub)graph isomorphism in many cases, especially in those cases that node skipping and node mismatching are allowed. However, no efficient node disjoint subgraph homeomorphism determination (ndSHD) algorithms have been available. In this paper, we propose two computationally efficient ndSHD algorithms based on s…
Previous work has suggested that the structural restrictions of graphs from classes of bounded expansion--locally dense pockets in a globally sparse graph--naturally coincide with common properties of real-world networks such as clustering and heavy-tailed degree distributions. As such, fixed-parameter tractable algorithms for bounded expansion classes may offer a promising framework for network analysis where other approaches have struggled to scale. However, there has been little work done in implementing and evaluating the performance of these structure-based algorithms. To this end we intr…
Graph pattern matching is a routine process for a wide variety of applications such as social network analysis. It is typically defined in terms of subgraph isomorphism which is NP-Complete. To lower its complexity, many extensions of graph simulation have been proposed which focus on some topological constraints of pattern graphs that can be preserved in polynomial-time over data graphs. We discuss in this paper the satisfaction of a new topological constraint, called Label-Repetition constraint. To the best of our knowledge, existing polynomial approaches fail to preserve this constraint, an…
In this paper, we show the existence of a polynomial time graph isomorphism algorithm for all graphs excluding graphs that are locally trianglefree. This particular class of graphs allows to divide the graph into neighbourhood sub-graph where each of induced sub-graph (neighbourhood) has at least 2 vertices. We construct all possible permutations for each induced sub-graph using a search tree. We construct automorphisms of subgraphs based on these permutations. Finally, we decide isomorphism through automorphisms . The author expects that the solution, present in this paper, may lead to a fast…
In this paper we resolve the complexity of the isomorphism problem on all but finitely many of the graph classes characterized by two forbidden induced subgraphs. To this end we develop new techniques applicable for the structural and algorithmic analysis of graphs. First, we develop a methodology to show isomorphism completeness of the isomorphism problem on graph classes by providing a general framework unifying various reduction techniques. Second, we generalize the concept of the modular decomposition to colored graphs, allowing for non-standard decompositions. We show that, given a suitab…
Vassilevska and Williams (STOC 2009) showed how to count simple paths on $k$ vertices and matchings on $k/2$ edges in an $n$-vertex graph in time $n^{k/2+O(1)}$. In the same year, two different algorithms with the same runtime were given by Koutis and Williams~(ICALP 2009), and Björklund \emph{et al.} (ESA 2009), via $n^{st/2+O(1)}$-time algorithms for counting $t$-tuples of pairwise disjoint sets drawn from a given family of $s$-sized subsets of an $n$-element universe. Shortly afterwards, Alon and Gutner (TALG 2010) showed that these problems have $Ω(n^{\lfloor st/2\rfloor})$ and $Ω(n^{\lflo…
The maximum common subtree isomorphism problem asks for the largest possible isomorphism between subtrees of two given input trees. This problem is a natural restriction of the maximum common subgraph problem, which is ${\sf NP}$-hard in general graphs. Confining to trees renders polynomial time algorithms possible and is of fundamental importance for approaches on more general graph classes. Various variants of this problem in trees have been intensively studied. We consider the general case, where trees are neither rooted nor ordered and the isomorphism is maximum w.r.t. a weight function on…
A 1978 theorem of Kozen states that two graphs on $n$ vertices are isomorphic if and only if there is a clique of size $n$ in the weak modular product between the two graphs. Restricting to bipartite graphs and considering complete bipartite subgraphs (bicliques) therein, we study the combinatorics of the weak modular product. We identify cases where isomorphism is tractable using this approach, which we call Isomorphism via Biclique Enumeration (IvBE). We find that IvBE is polynomial for bipartite $2K_2$-free graphs and quasi-polynomial for families of bipartite graphs, where the largest indu…
In this paper, we study the parallel and the space complexity of the graph isomorphism problem (\GI{}) for several parameterizations. Let $\mathcal{H}=\{H_1,H_2,\cdots,H_l\}$ be a finite set of graphs where $|V(H_i)|\leq d$ for all $i$ and for some constant $d$. Let $\mathcal{G}$ be an $\mathcal{H}$-free graph class i.e., none of the graphs $G\in \mathcal{G}$ contain any $H \in \mathcal{H}$ as an induced subgraph. We show that \GI{} parameterized by vertex deletion distance to $\mathcal{G}$ is in a parameterized version of $\AC^1$, denoted $\PL$-$\AC^1$, provided the colored graph isomorphism …
We give two algorithms computing representative families of linear and uniform matroids and demonstrate how to use representative families for designing single-exponential parameterized and exact exponential time algorithms. The applications of our approach include - LONGEST DIRECTED CYCLE - MINIMUM EQUIVALENT GRAPH (MEG) - Algorithms on graphs of bounded treewidth -k-PATH, k-TREE, and more generally, k-SUBGRAPH ISOMORPHISM, where the k-vertex pattern graph is of constant treewidth.