Definition
Neural subgraph matching is a model desinged to solve the subgraph matching problem using neural networks.
Architecture
Consider a subgraph and a target graph
Embedding
For each node in the query and target graph , obtain a -hop neighborhood around the anchor. The neighborhoods are embedded using GNN by computing the embeddings for the anchor nodes in their respective neighborhoods. The GNN is trained to have partial order relation in its embedding space.
Order Embedding

Order embedding enforces a partial order relationship between node embeddings of the sub graphs. It is used to capture the hierarchical relationship between graphs and subgraphs. A partial order is defined in the embedding space where larger graphs are located above of their subgraphs.

Subgraph isomorphism relationship can be encoded in order embedding space where is the dimension of the embedding space, and is the -th value of the embedding vector of subgraph anchor .

The GNN for the embedding is trained by minimizing a max-margin loss with Contrastive Learning examples. The margin between graph embedding of and are defined as The max-margin loss is defined as where is a set of positive pairs, and is a set of negative pairs.
Max-margin loss prevents the model from embedding all vectors to far from the origin.
Subgraph Prediction
Consider a query graph anchored at node , and a target graph anchored at node . By using the margin used for embedding, we can check whether is a node-anchored subgraph of the target graph . where is a hyperparameter works as a threshold.
To check if is isomorphic to a subgraph of , repeat this process for all and and aggregate the result to make the binary prediction for the decision problem of subgraph matching. Here is the neighborhood around the anchor node .