D 2 M ATCH : L EVERAGING D EEP L EARNING AND D EGENERACY FOR S UBGRAPH M ATCHING
Anonymous authors
Paper under double-blind review
A BSTRACT
Subgraph matching is a fundamental building block for many graph-based applications and is challenging due to its high-order combinatorial nature.
However, previous methods usually tackle it by combinatorial optimization or representation learning and suffer from exponential computational cost or matching without theoretical guarantees.
In this paper, we develop D 2 Match by leveraging the efﬁciency of Deep learning and Degeneracy for subgraph matching.
More speciﬁcally, we prove that subgraph matching can degenerate to subtree matching, and subsequently is equivalent to ﬁnding a perfect matching on a bipartite graph.
This matching procedure can be implemented by the built-in tree-structured aggregation mechanism on graph neural networks, which yields linear time complexity.
Moreover, circle structures, abstracted as supernodes , and node attributes can be easily incorporated in D 2 Match to boost the matching.
Finally, we conduct extensive experiments to show the superior performance of our D 2 Match and conﬁrm that our D 2 Match indeed tries to exploit the subtrees and differs from existing learning-based subgraph matching methods that depend on memorizing the data distribution divergence.
I NTRODUCTION
Graphs serve as a common language for modeling a wide range of applications (Georgousis et al., 2021) because of their superior performance in abstracting representations for complex structures.
Notably, subgraph isomorphism is a critical yet particularly challenging graph-related task, a.k.a., subgraph matching at the node level (McCreesh et al., 2018).
Subgraph matching aims to determine whether a query graph is isomorphic to a subgraph of a large target graph.
It is an essential building block for many applications, as it can be used for alignment (Chen et al., 2020), canonicalization (Zhou & Torre, 2009), motif matching (Milo et al., 2002; Peng et al., 2020), etc.
Previous work tries to resolve subgraph matching in two main streams, i.e., combinatorial optimization (CO)-based and learning-based methods (Vesselinova et al., 2020).
Early algorithms often formulate subgraph matching as a CO problem that aims to ﬁnd all exact matches in a target graph.
Unfortunately, this yields an NP-complete issue (Ullmann, 1976; Cordella et al., 2004) and suffers from exponential time cost.
To alleviate the computational cost, researchers have employed approximate techniques to seek inexact solutions (Mongiovì et al., 2010; Yan et al., 2005; Shang et al., 2008).
An alternative solution is to frame subgraph matching as a machine learning problem (Bai et al., 2019; Rex et al., 2020; Bai et al., 2020) by computing the similarity of the learned representations at the node or graph levels from two graphs.
Though learning-based models can attain a solution in polynomial time, they provide little theoretical guarantee, making the results suboptimal and lacking interpretability.
If not worse, the learning-based methods often cannot obtain the exact match subgraphs.
Ideally, we hope to develop a subgraph matching algorithm that can leverage the efﬁciency of learning methods while still maintaining theoretical guarantees.
We approach this by building the connection between subgraph matching and perfect matching on a bipartite graph.
We prove that ﬁnding the corresponding nodes between the query graph and the target one is equivalent to checking whether there is a perfect matching on the bipartite graphs generated by the nodes from the query graph and the target one recursely, yielding a much more efﬁcient subgraph matching algorithm solved in polynomial time.
𝑏 ′ 𝑐 ′ 𝑑 ′
𝑟 ′ 𝑏 1 0 0𝑐 1 1 0
𝑑 0 0 1 0 𝑟 0 0
1 𝑻 𝒂 ′ 𝒍+ 𝑎 ′ 𝑟 ′ 𝑎 ′ 𝑎 ′ 𝑎 ′ 𝑎 ′ 𝑏 ′ 𝑏 ′ 𝑏 ′ 𝑐′ 𝑐′ 𝑐′
𝑑 ′ 𝑎 ′ 𝑟 ′ 𝑎 ′ 𝑎 ′ 𝑎 ′ 𝑎 ′ 𝑏 ′ 𝑏 ′ 𝑏 ′ 𝑐′ 𝑐′ 𝑐′
𝑑 ′ 𝑻 𝒓 ′ 𝒍 𝑻 𝒅 ′ 𝒍 𝑻 𝒄
𝒍 𝑻 𝒃 ′ (𝒍) 𝑻 𝒂 𝒍+
𝑎 𝑏 𝑐 𝑑 𝑟 𝑎 𝑐 𝑔 𝑓 𝑎 𝑏 𝑏 𝑒 𝑎 𝑎 𝑐 𝑻 𝒃𝒍 𝑻
𝒄𝒍 𝑻 𝒅 𝒍 𝑻 𝒓𝒍 𝑎 𝑏 𝑐 𝑑 𝑟
𝑎 𝑐 𝑔 𝑓 𝑎 𝑏 𝑏 𝑒 𝑎 𝑎 𝑐 𝑑 𝑐 𝑏 𝑟 𝑐′ 𝑑 ′ 𝑟 ′ 𝑎 ′ 𝑏 ′ 𝑎 𝑒 𝑓 𝑔 𝑁 ( 𝑎 ) 𝑁(𝑎 ′ )
Query
Target
Theorem 4.2(condition 1&2)
Theorem 4.2 (condition 2&3)
Theorem 4.
P e r f e c t m a t c h
i n g 𝑻 𝒃 ′
(𝒍) 𝑻 𝒄 ′
(𝒍) 𝑻 𝒅 ′ (𝒍) 𝑻 𝒓
′ (𝒍) 𝑻 𝒃(𝒍) 𝑻 𝒄(𝒍) 𝑻 𝒅(𝒍) 𝑻 𝒓(𝒍) B i p a r t i t e g r a p h (1) (2) (3) (4)
This degeneracy allows us to harness the power of Graph Neural Networks (GNNs) to fulﬁll the matching by deploying a built-in tree-structured aggregation mechanism in GNNs.
Operating on node-level correspondences offers a node matching matrix, which allows us to locate the matched subgraph directly.
To incorporate more information, we augment the bipartite graph with supernodes , which wraps the circles, into the perfect matching procedure; see Fig.
1 for an illustration of the basic idea.
Moreover, node attributes can be easily included accordingly.
Our primary contribution is three-fold: (1) D 2 Match proposes a novel learning-based subgraph matching method, which frames the subgraph matching problem as perfect matching on a bipartite graph.
(2) We theoretically prove that this matching procedure can be implemented by the builtin tree structured aggregation mechanism on GNNs and yields linear time complexity.
Moreover, we can easily incorporate circle structures, abstracted as supernodes , and node attributes into our
D 2 Match to boost the performance.
(3) Extensive empirical evaluations show that D 2 Match outperforms state-of-the-art subgraph matching methods by a substantial margin and uncover that learningbased methods tend to capture the data distribution divergence rather than performing matching.
R ELATED WORK
Subgraph matching is to check whether a query graph is subgraph isomorphic to the target one (McCreesh et al., 2018).
Here, we highlight three main lines of related work:
Combinatorial optimization (CO)-based methods ﬁrst tackle subgraph matching by only modeling graph structure (Ullmann, 1976).
Recent work starts to facilitate both graph structure and node attributes (Han et al., 2013; Shang et al., 2008).
These combinatorial optimization methods often rely on backtracking (Priestley & Ward, 1994), i.e., heuristically performing matching on each pair of nodes from the query and the target graphs.
Such methods suffer from exponential computing costs.
A mitigated solution is to employ an inexact matching strategy.
Early methods ﬁrst deﬁne metrics to measure the similarity between the query graph and the target graph.
Successive algorithms follow this strategy and propose more complex metrics.
For example, Mongiovì et al.
(2010) convert the graph matching problem into a set-cover problem to attain a polynomial complexity solution.
Yan et al.
(2005) introduce a thresholding method to ﬁlter out mismatched graphs.
Khan et al.
(2011) deﬁne a metric based on neighborhood similarity and employ an information propagation model to ﬁnd similar graphs.
Kosinov & Caelli (2002) and Caelli & Kosinov (2004) align the nodes’ eigenspace and project them to the eigenspace via clustering for matching.
However, most of these algorithms cannot scale to large graphs due to the high computational cost, and their hand-crafted features make them hard to generalize to complex tasks.
Learning-based methods typically compute the similarity between the query and target graphs, e.g., comparing their embedding vectors.
Bai et al.
(2019) adopt GNNs to learn node representations of the query and target graphs, which employs a neural tensor network to match the graph pairs.
One immediate challenge is that a single graph embedding vector cannot capture the partial order information for subgraph matching.
Thus, Rex et al.
(2020) train a GNN model to represent graphs while incorporating order embeddings to learn the partial order.
These methods can compute graph-level representations, achieving high computational efﬁciency.
However, they miss the node-level information, which may lose critical details in subgraph matching.
To perform node-level matching, several methods (Bai et al., 2020; Li et al., 2019) introduce the graph-level representation into the node-level matching problem.
These methods often adopt different attention mechanisms to generate pairwise relations.
However, abusing the attention mechanism makes the model lack interpretability and theoretical guarantee.
Others transform the subgraph matching problem into an edge matching problem and generate prediction results through the matching matrix obtained by Sinkhorn’s algorithm (Roy et al., 2022), thereby providing interpretability for the model.
The process of turning node matching into edge matching, however, loses necessary information about edges’ relation, such as edges’ common nodes, which hurts the expressibility of the model.
Graph Neural Networks (GNNs) are powerful techniques (Xu et al., 2019; Kipf & Welling, 2017) yielding breakthroughs in many key applications (Hamilton et al., 2017b).
Over the last years, there has been considerable progress in proposing different ways of aggregating.
For example, GraphSAGE (Hamilton et al., 2017b) aggregates nodes features with mean/max/LSTM pooled neighboring information.
Graph Attention Network (GAT) (Velickovic et al., 2018) aggregates neighbor information using learnable attention weights.
Graph Isomorphism Network (GIN)
(Xu et al., 2019) converts aggregation as a learnable function based on the Weisfeiler-Lehman (WL) test instead of preﬁxed ones as other GNNs, aiming to maximize the performance of GNNs.
However, the WL test (Xu et al., 2019) cannot address the subgraph matching problem because it hashes the tree structure and loses the partial order information of subgraph matching.
P RELIMINARY
To make the notation consistent, we deﬁne them as follows:
Let A Q and A T be the adjacency matrix of the query graph G Q and the target graph G T , respectively.
N ( · ) denotes the neighbor set of a given node.
| · | denotes the size of a set.
T ( l ) v deﬁnes the subtree whose root is v and expands up to l -hop neighbors of v or l -layer of the subtree.
In the paper, the concepts of the l -hop neighbors and the l -layer subtrees are interchangeable.
Problem Deﬁnition: Suppose we are given a query graph, G Q ( V Q , E Q ) , and a target graph,
G T ( V T , E T ) .
Here, ( V Q , E Q ) and ( V T , E T ) are the pairs of vertices and edges related to the query graph and the target graph, respectively.
Besides, the node attributes of the query graph and the target graph are denoted as X Q ∈ R | V Q |× D and X T ∈ R | V T |× D , respectively, where D is the size of the node attributes.
The problem of subgraph matching is to identify whether the query graph is subgraph isomorphic to the target graph, i.e. if there exists an injective f : V Q → V T such that ∀ u, v ∈ V Q , ( u, v ) ∈
E Q ⇔ ( f ( u ) , f ( v ))
∈ E T .
Without loss of generality, we hypothesize that G Q is the subgraph of
G T , i.e., G Q ⊂ G T with | V Q | < | V T | .
In essence, the subgraph isomorphism test is to check a matching matrix S ∈ { 0 , 1 } | V T |×| V Q | , where S ij =
if and only if node pair ( i, j ) is matched.
G Q is isomorphic to G T is equivalent to checking whether the following conditions hold:
[Equation]
In the following, we ﬁrst deﬁne several key concepts in our work.
WL Subtree: The Weisfeiler-Lehman (WL) test is an approximate solution to the graph isomorphism problem with linear computational complexity (Shervashidze et al., 2011).
The WL test performs the aggregation on nodes’ labels and their neighborhoods recursively, followed by hashing the aggregated results into unique new labels.
As a result, this test produces an unordered tree for each node, called the WL subtree, which is a balanced tree with the height of the number of iterations.
After repeating the algorithm k times, the obtained WL subtree for a node includes the structural information of the k -hop subgraph from that node.
Research shows that the expressiveness of the
WL subtree is the upper limit of message passing GNNs (Xu et al., 2019).
Subtree Generation: Considering a node v , we can obtain a subgraph Sub ( l ) v by taking the lhop neighbor of v .
Given any tree generation method, e.g., the WL subtree, we always obtain a corresponding subtree whose root is v : T ( l ) v = Ψ
( Sub ( l ) v ) , (2) where Ψ is a subtree generation function.
Unless stated otherwise, we employ the WL subtree to generate subtrees for a given node due to its uniqueness (Xu et al., 2018).
Instead of explicitly constructing such trees, we can run GNNs in a graph, since building a k -order WL subtree is equivalent to aggregating k times in GNNs (Xu et al., 2018).
Notice that traditional methods such as BreadthFirst-Search (BFS) and Depth-First-Search (DFS) are not applicable at this work because they do not satisfy the uniqueness property.
In particular, the tree generated for the same node by BFS or
DFS will be different due to different search order.
Perfect Matching in Bipartite Graphs: A perfect matching (Gibbons, 1985) is a matching of a graph in which every node of the graph is incident to exactly one edge.
Performing perfect matching on a bipartite graph can be solved according to Hall’s marriage theorem (Hall, 1935).
Theorem 3.1.
(Hall’s marriage theorem)
Given a bipartite graph, B ( X, Y, E ) that has two partitions:
X and Y and | Y | ≤ | X | , where E denotes the edges.
The necessary and sufﬁcient condition of the existence of the perfect matching in B ( X, Y, E ) is : ∀ W ⊆ Y, | W | ≤ | N ( W ) | , where N ( W ) is the neighborhood of W deﬁned by N ( W ) =
{ b j ∈ X : ∃ a i ∈ W, ( a i , b j ) ∈ E } .
T HE P ROPOSED M ETHOD
This section describes the proposed D 2 Match.
We ﬁrst introduce the degeneracy of subgraph matching and propose an aggregation-based operation to address the degenerated problem, an efﬁcient solution with linear time complexity.
Following, we introduce two components designed to strengthen the matching ability by incorporating the circle structure and node attributes.
4. O N THE D EGENERACY OF THE S UBGRAPH M ATCHING P ROBLEM
We approach the subgraph matching problem from a degeneracy perspective, framing this problem as a subtree matching problem with linear complexity.
A fundamental question to the subgraph matching problem is on what conditions one subgraph is isomorphic to the other.
Since the subgraph matching problem is NP-complete, the exact answer to this question becomes impractical.
Instead, we can reduce the answer of ﬁnding both sufﬁcient and necessary conditions to that of necessary only.
What follows is to construct a criterion that any isomorphic pairs can meet.
We know that the subtree matching problem yields polynomial time cost.
Inspired by this, we attempt to construct the criterion by taking advantage of the subtrees rooted at these nodes, which degenerate subgraph matching to subtree matching and are guaranteed by the following theorem.
Theorem 4.1.
Given a target graph G T ( V T , E T ) and a query graph G Q ( V Q , E Q ) , if G Q ⊂ G T , and the subtree generation function Ψ as deﬁned in Eq.
(2) meets the following condition:
[Equation]
then there exists an injective function f : V Q → V T , ensuring the l -hop subtrees of the subgraph is isomorphic to the subtrees of the corresponding subgraph:
[Equation]
Please ﬁnd the proof in Appendix A.1.
This theorem provides a necessary condition for the potential isomorphic pairs, i.e., those who pass the test.
Given a query graph and a target graph, we can construct an indicator matrix S ∈ R | V T |×| V Q | by setting S tq to 1 when T q ⊂ T t and 0 otherwise.
The isomorphic test becomes to check the validity of Eq.
Due to the favorite property of uniqueness, we employ the WL subtree as the generation function.
Thanks to the built-in connection between the WL subtree and GNNs, we can convert the subtree matching problem to the problem of perfect matching on a bipartite graph and derive a GNN-based solution.
The following theorem guarantees the conversion:
Theorem 4.2.
Given a node q in the query graph and a node t in the target graph, the following three conditions are equivalent:
1) T ( l +1) q ⊂ T ( l +1) t . 2)
There exists an injective function on the neighborhood of these nodes as f : N ( q ) → N ( t ) , s
t. ∀ q i ∈ N ( q ) , t i = f
( q i ) , T ( l ) q i ⊂ T ( l ) t i .
3) There exists a perfect matching on the bipartite graph B ( l ) ( N ( t ) , N ( q ) , E ) , where ∀ t j ∈ N ( t ) , q i ∈ N ( q ) , ( t j , q i )
∈ E
if and only if T ( l ) q i ⊂ T ( l ) t j .
The proof is provided in Appendix A.2.
The equivalence of the ﬁrst two conditions implies that matching subtrees of a pair of nodes is equivalent to matching all subtrees from their child nodes.
As a result, the indicator matrix needs to be updated recursively.
That is, the indicator matrix at the ( l + 1 )-th layer, i.e., S ( l +1) , should rely on S ( l ) .
Meanwhile, the equivalence of the last two conditions means that matching the subtrees from these child nodes is equivalent to solving the perfect matching on the corresponding bipartite graph whose nodes represent the subtrees of the child nodes.
In summary, Theorem 4.2 tells us that subgraph matching is equivalent to delivering perfect matching on a bipartite graph.
A visualization of this procedure is shown in Fig.
Motivated by Hall’s marriage Theorem 3.1, we develop an efﬁcient algorithm to address the perfect matching procedure.
A straightforward solution is to randomly select a subset W from the given set of neighbors, N ( q ) in G Q , and count whether the corresponding neighbors of W in B ( l ) ( N ( t ) , N ( q ) , E ) , i.e. N ( W ) , have more elements than this subset.
After repeating this process multiple times for all node pairs, we obtain a perfect matching when no instance violates the criterion.
Is it possible to execute all pairs in parallel?
Luckily, we can borrow GNNs to accomplish the perfect matching.
Speciﬁcally, when computing a perfect matching between node q ∈ G Q and node t ∈ G T , one needs to ﬁnd W such that it satisﬁes
W ⊆ Y = N ( q )
according to Theorem 3.1.
In practice, we can obtain this by sampling the neighbors of node q, equating to sampling the edges, or the Drop Edge operation (Hamilton et al., 2017a).
In this way, we obtain a sampled graph G ′Q from the query graph G Q , along with its adjacency matrix ˜
A Q .
Following Theorem 3.1, we conclude that W = N ′ ( q ) with N ′ ( q ) ⊂ N ( q ) since node q’s neighbors in G ′Q are a subset of the original graph.
At each iteration, we will perform the counting w.r.t.
W and its neighbor set N ( W ) for each node pair ( t , q ) , and check whether | N ( W ) | ≥ | W | holds.
To be efﬁcient, we deﬁne a binary matrix, Φ ∈ R | V T |×| V Q | , where its element at ( t , q ) corresponds to the result of the node pair ( t , q ) .
Based on Theorem 4.1, we need to update the indicator matrix S recursively, making the update of Φ executed in recursion accordingly.
We next show that computing Φ is equivalent to performing the GNN-based aggregation on the related graphs for any given S ( l ) .
Theorem 4.3.
Given the sampled query graph and the target graph, we can construct their adjacency matrices , ˜ A Q and A T , and the degree matrix of the sampled query graph ˜ D Q = diag ( ∑ s (( ˜ A Q ) : s )) .
Here, we denote the indicator matrix at the l -th hop as S ( l ) .
To check the validity of | N ( W )
| ≥ | W | for each node pair, we can check whether each element of Φ is true or not, where Φ :
=
Z N ( W ) ≥ 1 ,
Z N ( W ) =
aggregate sum ( A T , Z TW ) and Z W = aggregate max ( ˜ D − 1 Q · ˜ A Q , ( S ( l ) ) T ) .
The proof is provided in Appendix A.5.
Recalling Theorem 3.1, we need to check | N ( W ) | ≥ | W | for each node pair ( t , q ) , i.e., to check whether each element of Φ is true for each sampled ˜ A ( k ) Q .
The condition is valid only when Φ is true for all iterations.
Hence we can check the criterion by the following element-wise product:
[Equation]
where ⊙ denotes the element-wise multiplication between matrices.
In practice, Φ ( l +1) ( ˜ A ( k ) Q , A T ) considers three cases:
[Equation]
The above three cases allow us to balance the computation cost and accuracy.
Initially, when k = 0 , we deliver a full-size sampling for all nodes to avoid induction bias.
When k = K , we perform the single-node sampling such that no node is omitted.
The cases of k ∈ [1 , K − 1] are computed via downsampling.
We want to highlight the difference between ours and other learning-based methods regarding GNNs.
Here we employ a GNN model to accomplish the procedure of subtree matching, along with theo- retical equivalence.
With the subtree representation learning, GNNs let other learning-based models capture the variance of data distribution for similarity inference since deep learning models learn distributional information to distinguish samples from different classes.
4. B OOSTING THE M ATCHING
The last section introduced a new method to address the subgraph matching problem based on the proposed necessary condition, which we call the base model.
Without sufﬁcient conditions, it cannot guarantee that all positive isomorphism pairs to be selected precisely.
To mitigate this issue, we further incorporate information such as circle structure and node attributes to ﬁlter out more nonisomorphism pairs.
4.2. D EALING WITH C IRCLES
Prior methods often leave the circle structure aside, however, such a structure is often unavoidable and critical in graphs.
In particular, learning-based methods rely on the expressibility of GNNs, which cannot model circles due to their subtree-structured aggregation.
The underlying idea of our
D 2 Match is to construct the circle structures as supernodes , which allow us to formulate the circle matching as a standard subtree matching problem.
Before detailing our strategy, we ﬁrst present two desired properties of the set of circles in a graph.
Atomic: Let r = ( v 1 , ..., v l ( r ) , v 1 ) ∈ C deﬁne a circle and v ( r ) be the set of nodes of circle r , a circle is an atomic circle if it does not contain a smaller circle.
That is, there is no circle r ′ such that v ( r ′ )
⊂ v ( r ) .
Here, C is the circle set.
Consistency: Each query circle must correspond to one circle in the target graph, i.e., ∃ f, ∀ r ∈ C
Q , f ( r ) ∈ C T .
C Q and C T are the circle sets of the query graph and the target graph, respectively.
The atomic property aims to ensure the compactness of circles, and the consistency attempts to ensure that the relation between a query and a target set of circles is injective.
These two properties ensure a well-qualiﬁed set for matching.
In practice, we can take advantage of chordless cycles (West, 2000), to serve our goal of matching circles.
We now state our theorem below to show that these cycles satisfy the above consistency and atomic property.
Theorem 4.4.
Every chordless cycle is atomic.
Every chordless cycle C Q in an induced subgraph of the original query graph G Q must correspond to a chordless cycle C T in the origin graph G T .
Please ﬁnd the proof in Appendix, A.6.
This theorem suggests that chordless cycles satisfy the above two properties, making them suitable for representing circles in a graph.
To match circles, we introduce an augmented graph by inserting supernodes that embody these circles.
Given a length L , we can acquire corresponding chordless cycles for the query and target graphs as : C T = { l ( r ) ≤
L, r ∈ CC ( G T ) } , C Q = { l ( r ) ≤ L, r ∈ CC ( G Q ) } .
By setting v r as the supernode of any chordless circle r , we connect nodes from the circle r to this supernode, resulting in an augmented graph.
Note that supernodes can only match other supernodes to keep the matching of non-circles untainted.
To this end, we transform the circle matching as the subtree matching problem such that we can employ the proposed method on the augmented graph directly.
Unless otherwise stated, we keep all notations the same in the augmented graph to avoid abusing the notations.
4.2. D EALING WITH N ODES ’ A TTRIBUTES
Apart from the above structure information, subgraph matching also involves node attributes.
Within the context of subgraph matching, learning with node attributes alone may be misled because these cannot catch structural isomorphism.
As a result, we employ the obtained subtree indicator matrix to supervise the learning process, aiming to ﬁlter out pairs that do not pass the test in the subtree matching.
We are thus motivated to enhance the node attributes by concatenating the subtree matching indicator, resulting in the node representation for the query and target graphs as follows:
[Equation]
Here, we employ an MLP model to reduce the effect of the difference between the node attributes and the indicator matrix, where the latter behaves like a one-hot feature.
We concatenate each pair of representations and then pass it to the MLP to obtain their similarity.
For the node pair ( i, j ) , we have the similarity computed as
[Equation]
Now we arrive at a generalized indicator matrix that considers both the structure and node attribute information S ( l +1) =
S ( l +1) gnn ⊙ S ( l +1) subtree .
Require:
A query graph G Q ( V Q ,E Q ) with node attributes X Q , a target graph G T ( V T ,E T ) with node attributes X T , iteration number: L , sample number: K .
Ensure: Is G Q isomorphic to G T 1: G Q ( V Q ,E Q ) ← ChordlessCycleAugment ( G Q ) ; G T ( V T ,E T )
← ChordlessCycleAugment ( G T ) ; 2: H (0) Q = X Q ; H (0) T = X T ; 3: S (0) subtree =
InitialAssignMatrix ( X T ,X Q )
▷ Initialize assignment matrix; 4: for l = 0 , 1 ...,L − 1 do 5: for k = 0 , 1 ,...,K do 6: ˜ A ( k ) Q = DropEdge ( A Q )
; ▷ Sample adjacency matrix 7:
Calculate Φ ( l +1)
( ˜ A ( k ) Q ,A T ) according to Eq.
8: end for 9:
S ( l +1) subtree = ⊙ Kk =
Φ ( l +1)
( ˜ A ( k ) Q ,A T ) ; ▷ Final subtree assignment matrix 10:
H ( l +1) T = GNN ( l ) T ( A T ,concat [ H ( l ) T ,MLP ( S ( l ) )]) ; 11:
H ( l +1) Q = GNN ( l ) Q ( A Q ,concat [ H ( l ) Q ,MLP (( S ( l ) ) T )]) ; ▷ GNN update 12:
Compute S ( l +1) gnn according to Eq.
▷ Final GNN assignment matrix 13:
S ( l +1) =
S ( l +1) gnn ⊙ S ( l +1) subtree ; ▷ Final assignment matrix 14: end for 15: result = CheckAssign ( S ( L ) )
4. I MPLEMENTATION D ETAILS AND C OMPLEXITY A NALYSIS
We summarize the overall procedures in Algorithm.
The computation of D 2 Match has two major parts: the subtree and GNN modules.
Given L layers and K times of sampling, the complexity of the subtree and GNN modules are O
( L ∗ K ∗| V T |∗| E Q | + L ∗| V Q |∗| E T | ) and O ( L ∗| E T | + L ∗| E Q | + |
V T | ∗ | V Q | ) , respectively.
Since the query graph is often very small, we can treat | V Q | and | E Q | as constants.
A detailed runtime comparison is in Appendix A.5.
Therefore, the overall complexity is reduced to O ( | V T | + | E T | ) , attaining linear time complexity.
Please refer to Appendix A.1 for more details about the implementation.
E XPERIMENTS
Here, we conduct extensive experiments to answer the following questions: (1) How does our proposed D 2 Match compare to SOTA methods?
(2) Why GNNs in ours and others yield different results?
(3) How robust does D 2 Match perform?
Sec.
5.2-Sec.
5.5 answer the above questions accordingly.
5. E XPERIMENTAL S ETTINGS
Datasets and Experimental Setup.
We implement our experiments on both synthetic and realworld datasets, which are collected from a large variety of applications.
We aim to obtain pairs of query and target graphs, along with labels indicating whether a query is isomorphic to the target.
We ﬁrst generate synthetic data by utilizing ER-random graphs and WS-random graphs (Rex et al., 2020).
We keep edge densities the same in both positive and negative samples to ensure consistency in the distribution.
This balance avoids potential biases during learning.
For the real-world data, we follow the setting in (Rex et al., 2020), including Cox2, Enzymes, Proteins, IMDB-Binary, MUTAG,
Aids, and FirstMMDB.
We also conduct additional experiments on the Open Graph Benchmark datasets(Hu et al., 2020) and three datasets with continuous features in Appendix A.7.
We employ these raw graphs as target graphs and generate the positive query graphs by randomly sampling from the target graphs.
The negative query graphs are randomly generated.
Similar to the synthetic data, we require the edge density in both positive and negative samples to be as close as possible.
We split each dataset into training and testing at a ratio of 4 : 1 and report the average classiﬁcation accuracy under the ﬁve-fold cross-validation.
[Table]
To get a fair comparison, we select the following SOTA competitors: SimGNN (Bai et al., 2019), NeuralMatch (Rex et al., 2020), IsoNet (Roy et al., 2022), GMN-embed (Li et al., 2019)
GraphSim (Bai et al., 2020), and GOT-Sim (Doan et al., 2021).
These all incorporate graph neural networks into subgraph matching.
We present the comparison with exact methods in Appendix A.8.
M AIN R ESULTS
Table 1 reports the overall performance of all compared models, where each model achieves the best results in all possible settings up to 500 epochs.
The accuracy of GOT-Sim and IsoNet on
FirstMMDB is omitted due to exceeding time and memories.
We observe that - For the synthetic dataset, the overall performance is much lower than that in the real-world datasets.
A reason is that the synthetic dataset is more complicated, e.g., with a higher edge density, than real-world datasets, which makes the matching more challenging.
By examining more details,
IsoNet, GMN-embed, GraphSim, and GOT-Sim attempt to employ a node-level assignment matrix to capture matching between graphs, which underestimate the importance of global structure.
They can only yield around 50% accuracy.
SimGNN and NeuroMatch try to learn the global representation and attain the accuracy of 70 .
5% and 65.7%, respectively.
- For the real-world datasets, D 2 Match attains superior performance and beats all baselines.
Among seven real-world datasets, D 2 Match attains 100% accuracy in four datasets, i.e., Protein, Mutag,
Cox2, and FirstMMDB, while at least 99 .
5% in Enzymes and Aids, and 93 .
3% in IMDB-Binary.
- Overall, D 2 Match has explicitly modeled subtress and consistently attained the best performance among all compared methods.
The promising results conﬁrm our theoretical analysis.
5. B ENEFIT OF O UR C ORE D ESIGN : T HE S UBTREE M ATCHING
Though GNNs deployed in D 2 Match and existing learning-based subgraph matching methods, they function differently.
D 2 Match utilizes GNNs to explicitly models subtrees while learning-based methods learn the graph representations via memorizing the data distribution divergence.
To validate this, we construct new datasets and denote them with ∗ by excluding the data distribution effect.
We ﬁrst follow the same way as generating positive samples, then continue to perform edge dropping and insertion on the clipped graphs together to obtain the ﬁnal negative samples.
This strategy aims to make sure the generated samples, both positive and negative, following the same distribution in terms of edges.
We also build an new synthetic dataset without following this property, called
Synthetic + , for a better comparison.
Since SimGNN and NeuoMatch are the best-performing GNNbased methods in Table 1, we select them in the comparison.
Results in Table 2 show that D 2 Match outperforms SimGNN and NeuoMatch by a much larger margin, achieving 2 .
5% − 33 .
2% improvement.
This phenomenon aligns with our hypothesis that the gain of other learning-based methods is distribution-dependent, which results in a signiﬁcant performance drop on evenly-distributed data.
Moreover, the overall performance on Synthetic + is much better than that on Synthetic.
This implies that data following non-even distribution will make the matching much easier.
This is in line with the results in Table 1, i.e., the learning-based methods tend to capture the distribution divergence rather than performing matching.
5. A BLATION S TUDIES
Effect of L , the depth of a subtree.
We test the effect of the depth of a subtree, i.e., the number of the hidden layers, and change it from 1 to 7.
Results in Fig.
2(a) shows that D 2 Match reaches [Table] its best performance when the number of layers is 6.
D 2 Match only needs a few layers to achieve a decent performance, suggesting it can scale up to large size graphs.
Effect of K , the times of samples.
Intuitively, sampling more data to train the model will yield better performance.
We vary K from 1 to 7 and show the results in Fig. 2(b).
Surprisingly, the results show that by sampling ﬁve times, we can obtain the best performance on all datasets.
This demonstrates that D 2 Match can attain decent performance in a low computation cost.
We also ablate D 2 Match with circles and node attributes at different settings, and all experiments show results consistent with our theoretical analysis.
Please refer to Appendix A.3 for more details. [Figure] [Figure]
SimGNN
[Figure]
5. C ONVERGENCE A NALYSIS
Figure 2(c) provides the training loss of D 2 Match and four baselines on Synthetic, where we only select baselines with the same loss functions as ours, such as MSE or CE, for a fair comparison.
The results show that (1) D 2 Match converges the fastest due to its power of explicitly modeling the subtrees.
(2) NeuroMatch and SimGNN perform matching through learning graph-level representations, which need more epochs to converge for capturing the local structure.
(3) GOTSim and GraphSim attain the lowest loss in the beginning but show the weakest convergence ability compared to others because they can only capture the node-level representations and fail to learn meaningful subgraph matching.
Consequently, they yield the worst performance as reported in Table 1.
C ONCLUSION AND F UTURE WORK
In this paper, we propose D 2 Match for subgraph matching, which degenerates the subgraph matching problem into perfect matching in a bipartite graph and prove that the matching procedure can be implemented via the built-in tree-structure aggregation on GNNs, which yields polynomial time complexity.
We also incorporate circle structures and node attributes to boost the matching.
Finally, we conduct extensive experiments to show that D 2 Match achieves signiﬁcant improvement over competitive baselines and indeed exploits subtrees for the matching, which is different from existing learning-based methods for memorizing the data distribution divergence.
D 2 Match can be further explored in several promising directions.
First, we can investigate more degeneracy mechanisms to tackle more complicated graphs.
Second, we can extend our D 2 Match to more real-world applications, e.g., document matching, to know its capacity.
REPRODUCIBILITY STATEMENT
The supplemental material includes the code for our experiments.
An detailed description of the datasets used in the experiments is provided in Appendix A.6.
A A PPENDIX
Theorem A.1.
Given a target graph G T ( V T , E T ) and a query graph G Q ( V Q , E Q ) , if G Q ⊂ G T , and the subtree generation function Ψ as deﬁned in Eq.
(2) meets the following condition:
[Equation]
then there exists an injective function f : V Q → V T , ensuring the l -hop subtrees of the subgraph is isomorphic to the subtrees of the corresponding subgraph:
[Equation]
Proof.
According to the deﬁnition of subgraph matching (McCreesh et al., 2018), when G Q is a subgraph of G T , there must exists an injective function f : V Q → V T ,
such that ∀ q
i , q j ∈
V Q , ( q i ,
q j ) ∈
E Q ⇒ ( f ( q i ) , f ( q j ))
∈ E T .
For any subgraph in the query graph, e.g., S ( V S , E S ) ∈
G Q , we always have a subgraph in the original graph G T , denoted as G S ( V G , E G ) , that corresponds to the set of the query node as V G =
f
( V S ) .
This tells us that S ⊂ G S .
According to this, consider any given node from V Q : q ∈ V Q , S ( l ) q is a subgraph of G Q and its image G S ( l ) q in
G T , i.e. S ( l ) q ⊂ G S ( l ) q .
By deﬁnition, the node in S ( l ) q or G S ( l ) q is at most l -hop from node q or t = f ( q ) , we know that G S ( l ) q must be a subgraph of S ( l ) t , i.e., G S ( l ) q ⊂ S ( l ) t .
Put all together, we have S ( l ) q ⊂ G S ( l ) q ⊂ S ( l ) t .
Based on the listed constrain, we then have T ( l ) q ⊂ T ( l ) t .
Theorem A.2.
Given a node q in the query graph and a node t in the target graph, the following three conditions are equivalent:
1) T ( l +1) q ⊂ T ( l +1) t . 2)
There exists an injective function on the neighborhood of these nodes as f : N ( q ) → N ( t ) , s.t.
∀ q i ∈ N ( q ) , t i = f
( q i ) , T ( l ) q i ⊂ T ( l ) t i . 3)
There exists a perfect matching on the bipartite graph B ( l ) ( N ( t ) , N ( q ) , E ) , where ∀ t j ∈ N ( t ) , q i ∈ N ( q ) , ( t j , q i ) ∈
E
if and only if T ( l ) q i ⊂ T ( l ) t j .
We prove this theorem by introducing the following two theorem.
Theorem A.3 shows that condition 1) is equivalent to condition 2), i.e. the WL subtree isomorphism test can be accomplished in a recursive manner then prove Theorem.
A.4 that the condition 2) equals to condition 3) which means every iteration in the recursive process equals to examine the existence of a perfect matching, respectively.
Theorem A.3.
Given a node q in the query graph and a node t in the target graph, the following two conditions are equal:
1) T ( l +1) q ⊂ T ( l +1) t , where l is an integer and l ≥ 1 . 2)
There exists an injective function on the neighboring set of these nodes as f : N ( q ) → N ( t ) , s.t.
∀ q i ∈ N ( q ) , t i = f
( q i ) , T ( l ) q i ⊂ T ( l ) t i .
Proof.
We assume f q is a subtree isomorphism injective function in the condition 1), that ∀ node u, v ∈ T ( l +1) q , ( u, v ) is an edge of T ( l +1) q ⇒ (( f q ( u ) , f q ( v )) is an edge of T ( l +1) t .
Similarly We also assume f q i is subtree isomorphism injective in the condition 2).
On the one hand, if condition 1) is true then f q exists.
Using the property of WL tree, we have ∀ q i ∈ N ( q ) , T ( l ) q i ⊂ T ( l +1) q , which means the l -order WL tree of any node q i in q’s neighbourhood belongs to the l + 1 -order WL tree originate from the node q.
This suggests that f q maps T ( l ) q i into a tree T ( l ) f ( q i ) =
T ( l ) t i , which is a subtree of T ( l +1) t ,.
Then the condition 2) is true.
On the other hand, if condition 2) holds, then we deﬁne the mapping as f q ( v ) =
{ f q i ( v ) , v ∈ T ( l ) q i q , v = q .
Here, the function f b ( v ) is a standard injective function T ( l ) b i
This implies this is a subtree isomorphic mapping, so 1) holds.
The above theorem provides a recursive solution to the WL subtree isomorphism algorithm.
Intuitively, we can maintain an indicator matrix S ( l ) ∈ R
| V T |×| V Q | , where S ( l ) tq = { 1 , T ( l ) q ⊂ T ( l ) t 0 , else .
This matrix captures the relation between all pairs of nodes and thus can be used for recursion update.
Next, we will show that the update process can be implemented as a perfect matching problem, i.e., what makes condition 2) true is equivalent to ﬁnding a perfect matching on a bipartite graph, as shown in the following theorem:
Theorem A.4.
Assume the neighboring set of node t and q as X = N ( t ) and Y = N ( q ) , respectively.
Accordingly, we form a bipartite graph as B ( l ) t , q ( X, Y, E ) .
Here, we deﬁne the edges as
E = { ( t i , q j ) : T ( l ) q i ⊂ T ( l ) t j } , where t i and q j represent the i th and j th neighbour of node t and q, respectively.
Under this setting, the injective function f from the condition 2) in Theorem.
A. induces a perfect matching.
Proof.
The injective function f of condition 2) in Theorem A.3 maps every node q i in N ( q ) to t i = f
( q i ) ∈ N ( t ) and T ( l ) q i ⊂ T ( l ) t i holds.
While T ( l ) q i ⊂ T ( l ) t i means ( q i , t i ) ∈ E , the injective f naturally corresponds every node q i to an edge ( q i , t j ) .
Since f is an injective function, q i 1 ̸ = q i 2 ⇒ t i 1 ̸ = t i 2 , indicating that all these edges ( q i , t i ) , i = 1 , ..., | N ( q ) | are different, which actually forms a perfect matching.
Theorem A.5.
Given the sampled query graph and the target graph, we can construct their adjacency matrices , ˜ A Q and A T , and the degree matrix of the sampled query graph ˜ D Q = diag ( ∑ s (( ˜ A Q ) : s )) .
Here, we denote the indicator matrix at the l -th hop as S ( l ) .
To check the validity of | N ( W )
| ≥ | W | , we can check whether each element of Φ is true or not, where Φ :
= Z N ( W ) ≥ 1 , Z N ( W ) =
aggregate sum ( A T , Z TW ) and Z W = aggregate max ( ˜ D − 1 Q · ˜ A Q , ( S ( l ) ) T ) .
Proof.
For each node pair t , q and their corresponding W = N ′ ( q ) in the sampled query graph, We ﬁrst transform the neighboring set of W , i.e., N ( W ) , as following:
[Equation]
Let M ( q ) =
{ t i | max q ′ ∈ N ′ ( q ) S ( l ) t i , q ′ = 1 } , we can compute M ( q ) via a standard maximizing aggregation process on the sampled adjacency matrix ˜
A Q , in which treats the indicator matrix ( S ( l ) )
T ∈ R | V Q |×| V T | as node attributes.
This process will output the representation of node q as follows,
[Equation]
The obtained vector z q , : is to represent M ( q ) where z q i = { 1 , i ∈ M ( q
[Equation]
0 , else .
We rewrite this into a matrix format as
[Equation]
where Z W ∈ R | V Q |×| V T | and its q-th row vector is z q : .
Recall that we demand N ( W ) =
N ( t ) ∩ M ( q ) .
After acquiring M ( q ) , we can compute the | N ( W ) | as follows,
[Equation]
In essence, this is to implement a summation aggregation on the target graph using the node representation Z W , i.e.,
[Equation]
15) where Z N ( W ) ∈ R | V T |×| V Q | is an integer matrix and its element ( t , q ) shows the score of | N ( W ) | between node t and q. This transformation converts the counting operation as aggregation such that we can check the aggregated values to determine whether there is a perfect matching.
Given a node pair ( t , q ) , we have | N ( W ) | =
[ Z N ( W ) ]
tq and | W | = | N ′ ( q ) | =
∑ s [ ˜ A Q ] q s .
Therefore, the question becomes to check whether [ Z N ( W ) ]
tq ≥ ∑ s [ ˜ A Q ] q s holds.
We can then derive the perfect matching as follows:
[Equation]
16) where ˜ d q is the degree of node q in the sampled graph.
The degree matrix of the sample graph is deﬁned as ˜ D Q = diag [ ∑ s (( ˜ A Q ) : s )] .
Now recall that Φ is the matrix whose ( t , q ) element is the comparison result of | N ( W ) | and | W | of ( t , q ) , according to eq 16, we have:
[Equation]
where
[Equation]
Theorem A.6.
Every chordless cycle is atomic.
Every chordless cycle C Q in an induced subgraph
G Q must correspond to a chordless cycle C T in the origin graph G T .
Proof.
Chordless cycle does not have any chord, thus there is no smaller cycle in the chordless cycle, which means chordless cycle is atomic.
Assuming G Q is a subgraph of G T , every node of C Q must correspond to a node in G T , and these nodes form a circle C T in G T .
Since G Q is an induced subgraph of G T , if C T has a chord, then C Q must have a chord, which contradicts the condition that C
Q is a chordless graph.
A. I MPLEMENTATION D ETAILS
The python implementation of D 2 Match is available at: https://www.dropbox.com/sh/8pvj8drvj0l2zou/AAB5j7e7frVwMiun1QcCNbMFa?
dl=
At the beginning of subtree isomorphism test, the model needs an initial indicator matrix S (0) subtree as the input of the ﬁrst iteration.
According to the deﬁnition of the indicator matrix, S (0) subtree shows the isomorphism relation between the subtree of 0 -hop neighbors, which are the nodes themselves in this case.
Since all nodes will be isomorphic to each other if not considering the node attributes, the indicator matrix S (0) subtree is actually a similarity matrix w.r.t node attributes.
To get a similarity matrix of attributes, we can either directly calculate the similarity between nodes or employ neural networks on these attributes to learn the matrix.
In our model, we implement both methods to initialize the matrix, called the initialization of the raw and the learnable:
[Equation]
where the raw initialization is to calculate the cosine similarity between the nodes’ attributes, and the learnable initialization employs a MLP to generate hidden representations of nodes and compute their dot similarities.
In practice, we ﬁnd the raw initialization performs better.
This is because the node attributes of datasets are usually binary categorical vectors, which induces clear identiﬁcation information of the nodes and can be easily captured by cosine similarity.
Our implementation of the GNN block in the model is slightly different from the description.
Specifically, we use compute the similarity of each pair of nodes as:
[Equation]
The main difference is that we do not output a | V T |×| V Q | matrix, but a | V T |×| V Q |×| D
( l +1)
| tensor, where D ( l +1) denotes the hidden dim of l + 1 layer.
The intuition is that a tensor that represents the node pairs’ similarity with vectors can retain more information than a similarity matrix with scalar elements.
In this setting, the ﬁnal indicator matrix S ( l +1) can not be generated as S ( l +1) =
S ( l +1) gnn ⊙ S ( l +1) subtree , because S ( l +1) subtree ∈ R | V T |×| V Q | but S ( l +1) gnn ∈ R
[Equation]
|×| V Q |×| D ( l +1) | .
Thus we broadcast S ( l +1) subtree to ˜ S
( l +1) subtree where ∀ k ∈ [0 , D ( l +1) ) , [ ˜ S ( l +1) subtree ] ijk =
[ S ( l +1) subtree ] ij and the ﬁnal indicator matrix S ( l +1) =
S ( l +1) gnn ⊙ ˜ S ( l +1) subtree
At the end of our models, we get the subtree indicator matrix S ( L ) subtree and the GNN indicator matrix
S ( L ) gnn .
The model will output the ﬁnal score from S ( L ) subtree and S ( L ) gnn , respectively.
For the subtree module, we check whether the indicator matrix is feasible to induce the subgraph isomorphism.
Note that for a node i in the target graph and a node j in the query graph, i is possible to match j unless [ S ( L ) subtree ] ij = 1 .
So we check whether the subtree indicator matrix meets the following two conditions:
Every node in a query graph should match at least one node in the target graph:
[Equation]
The number of nodes in the target graph that match at least one node in the query graph is more than the number of nodes of query graph:
[Equation]
To make the subtree model differentiable, we use a learnable sigmoid to replace all the logical judgment in the model:
[Equation]
(23) where a, b are learnable parameters; σ is the sigmoid function.
The result of subtree module can be fomulated as:
[Equation]
For the GNN module, we employ the neural tensor network(NTN)
(Bai et al., 2019) and generate a score according to the output of NTN and the aggregated indicator tensor:
[Equation]
Where H ( L ) T , H ( L ) Q are the node representations generated by the GNNs.
NTN is the NTN layer.
The ﬁnal prediction is:
[Equation]
Although the model’s prediction is obtained by integrating the two modules, we can not directly train the model through the ﬁnal score r because it will bring difﬁculties in the training process.
When ﬁtting a negative sample, the resulting subtree module tends to be zero, forcing the overall gradient to be zero which hinders the training of the GNN module.
Therefore, we train the two blocks with different objectives.
For the subtree module which aims to learn the isomorphism relation, the result should be either 0 for not matching or 1 for matching.
So we employ MAE loss to enforce the results to be either 0 or 1 .
For the GNN module, we use MSE to encourage the output of GNNs to capture the similarity.
Suppose the ground-truth label is y , and our loss function is
[Equation]
Both our model and all baselines use the Adam as optimizer and set the learning rate to 3 e − 4 .
To ensure fairness, we set all models with adjustable number of layers to 5 layers, and set the hidden dimension to 10.
[Figure] [Figure]
Recall that D 2 Match learns an indicator matrix to capture pairwise similarities.
It plays the role of permutation matrix in matching, allowing us to pinpoint the matched subgraph.
This is particularly useful since the exact position is required for some downstream applications such as web search.
In comparison, other learning-based methods are unable to pinpoint local correspondences, but only establish the existence of a matching.
We provide a visualization of the matched subgraph to better understand the problem difﬁculty and the effectiveness of our method, as shown in the Fig. 3.
A. A BLATION S TUDIES
We conduct ablation studies for the GNN module, subtree module and the chordless cycles.
In our analysis, the GNN module will capture the distribution features on the graph, such as the edge density difference between classes.
Thus, the GNN module is necessary for datasets with multiple distributions, called biased data.
We run the experiment on the biased Synthetic + dataset and unbiased Synthetic dataset and compare the performance of D 2 Match and D 2 Match without the GNN module, as shown in Table 3.
D 2 Match outperforms D 2 Match without the GNN module, which is consistent with our analysis. However, our GNN module shares the same weaknesses as the other GNN models dealing with evenly distributed data. As can be seen, the performance of the
GNN module drops signiﬁcantly on the hard datasets, which is consistent with other normal GNN models.
The subtree module is a major part of our model and can signiﬁcantly improve model performance.
It takes advantage of the property of subgraph-matched data itself so it is harder to be affected by the [Table] [Table] distribution of the dataset.
In our ablation study, our subtree module outperformed the GNN module on the all normal and hard datasets, which demonstrates its effectiveness.
We also perform the ablation study on the Synthetic dataset to test the effect of chordless cycles,as shown in Table 4.
Results show the chordless cycles boost the performance with limited extra time consumption.
[Table]
[Table]
[Table]
A. R ANDOM E FFECT
Although our experiments do not rely on random seeds, a random split may affect the results.
To test this, we set up several random seeds and permute the raw data order before getting the ﬁve-fold.
We experiment on the Protein and Mutag datasets with trivial random seed 0,1,2 and obtain nearly identical performance.
See Table 5.
While other methods based on GNNs tend to capture the divergence of distributions in the training set and hence are easily affected by randomness, our subtree module performs the matching explicitly by the degeneracy property, as opposed to modeling the data distribution in others, hence ours is insensitive to data partitioning.
A. R UNTIME A NALYSIS
We add the runtime analysis experiment as follows.
We compare our method with baselines on the synthetic dataset and record the training and inference time(second) per epoch. The results are shown in Table 6. Although our model is slower than some strong baselines like SimGNN and NeuroMatch in the experiment because they only compare the graph-level representations. Our model is faster than
IsoNet, which performs edge-level matching.
[Table]
We conduct an additional ablation study to explore the time consumption of each module in our model.
The results show that the time consumption of our model mainly comes from the sampling in the subtree module whose running time is linearly related to the sampling number.
When we set the sampling number as 2, the running time is on par with the others.
Furthermore, the running time for the GNN module is the same as for the other baselines.
In sum, we observe that our model’s scalability is acceptable as both complexity analysis and empirical running time show ours is slower than others only by a constant factor.
A. D ATASET D ETAILS
We describe the average node number and average edge number of the target graph and query graph in the Table 8 and Table 7.
Except the hard datasets, we generate 1000 graph pairs for Synthetic,
Proteins, Mutag, Enzymes, Cox2 and FirstMMDB and 2000 graph pairs for Aids and IMDB-Binary which have smaller graph size.
For the hard dataset, we uniformly generate 500 graph pairs.
A. R ESULTS ON M ORE D ATASETS
We conduct experiments on the OGB benchmark dataset(Hu et al., 2020), including Ogbg-molhiv and Ogbg-molpcb.
We follow the same strategy in the paper to construct normal and hard versions for these datasets and choose the best-performing baselines for comparison, including SimGNN and NeuroMatch. We present new results in Table 9. We ﬁnd that our model performs slightly better than others on normal datasets while gaining a signiﬁcant advantage over baselines on hard datasets.
These results are consistent with our previous experiments, demonstrating that our model exploits the subgraph matching property, rather than simply modeling the divergence of the data distribution as other GNNs.
We experiment on continuous features from the MNIST, CIFAR10 and PPI datasets, as these are constructed from vision data(Dwivedi et al., 2020) or biological information data(Zitnik & Leskovec, 2017).
We As expected, our model achieves consistent performance as well.
See Table [Table] [Table] A. C OMPARISON WITH E XACT M ETHOD
we compare exact matching solutions, including VF2[1] and ISMAGS[2].
By nature, we know that exact matching methods obtain 100 % accuracy.
As a trade-off between accuracy and execution time, we make the comparison inspired by the setup in NeuroMatch(Rex et al., 2020).
We say an execution succeeds when its run time is less than 60s.
We compare the success rate of the exact methods by varying the query graph size from 10 to 50 on the synthetic data.
Figure shows the result.
We show in our experiment that the failure of exact matching methods increases signiﬁcantly when the target graph has more than 30 nodes, compared to our stable performance, indicating the incompetence of these methods on large-scale datasets.
[Figure]