Conference paper

GHL: An Extensible C++ Library for Flexible and Performant Graph Pattern Matching and Rewriting

Abstract

Graph pattern matching and replacement are foundational techniques spanning domains from cheminformatics to deep learning. Existing graph libraries, however, often expose a trade-off between performance and flexibility: general-purpose libraries incur substantial overhead and rarely offer integrated replacement support, while domain-specific infrastructures lack generality. In this paper, we introduce the Graph Hook Library (GHL), a modular and extensible C++ architecture with Python bindings for high-performance graph pattern matching and rewriting. GHL exposes explicit hooks, architectural extension points that enable fine-grained specialization of match-and-replace behavior. This structure supports rapid adaptation to diverse application domains without compromising efficiency. GHL source code is available at https://github.com/IBM/graph-hook-library. Benchmarking shows that GHL performs subgraph matching 2.3x/100x/207x faster than the general-purpose libraries iGraph/NetworkX/Graph-tool.