How does one typically do subgraph isomorphism?

MAGE doesn’t seem to contain this algorithm. So I was wondering. Do I just build up a query that will match the subgraph(s) that I I am interested in?

MAGE does contain such an algorithm inside the nxalg module. Here it is. In the docs you can see the example usage.

1 Like

Thanks! :blush: I see that now. But can we search for isomorphic subgraphs, isomorphic to a query graph?

Technically, you can maybe query the first subgraph (create a Cypher query that uniquely determines some subgraph) and query the second graph such that it represents all other subgraphs except for the subgraph from the first query. That should give you the results for all other subgraphs, and you can return those subgraphs if is_isomorphic is true. It is definitely not a one-line solution and you can think more about that. You can also create a query module in which you do all of that. Here is how - Implement a custom query module in Python | Memgraph Docs.

1 Like