snap-stanford / neural-subgraph-learning-GNN

340 stars 64 forks source link

How to use NeuroMatch to predict / output the set of Target subgraphs that matches well with the Query subgraphs? #17

Closed jessxphil closed 3 years ago

jessxphil commented 3 years ago

Hi! And thanks in advance for details on these issues. I read through the paper "Neural Subgraph Matching" and I only see information on extracting a 'YES' or a 'NO', from NeuroMatch. But I would like a prediction that outputs a set of Target subgraphs that are "supergraphs" to the Query Graph.

Also, is there a decoder available to reform the embedded graphs back into it's original data following the prediction?

Thanks again!

qema commented 3 years ago

To identify where the query graph appears within the target graph, one can make use of the outputted alignment matrices -- subgraph_matching/alignment.py outputs such a matrix -- and run a matching algorithm such as the Hungarian algorithm to find which nodes in the query graph match most strongly with which nodes in the target graph.

Identifying all instances where the query appears may be computationally much harder since there may be combinatorially many instances. In this case it may be useful to directly use a subgraph enumeration algorithm such as mfinder or ISMAGS.

Transforming the embeddings back to the original data is an interesting question. There is no code for it currently in the repo. We've had some luck using gradient descent to optimize an adjacency matrix to minimize the MSE between the encoder output and the desired embedding. However, it's again a hard problem since most of the embedding space may not correspond to a valid graph. Usually there's a way to avoid having to take the inverse transform, perhaps by maintaining the graph that corresponds to the current embedding (as done in the subgraph mining module).