Search code examples
memgraphdb

Does Memgraph support subgraphs?


Does Memgraph support subgraphs? I'm referring to projected graphs that are sometimes called subgraphs. Which graph projection functions are supported in Memgraph?

Here is the code that I've tried but that didn't work for me:

MATCH p=(n:Node)-[:CONNECTS_TO]->(m:Node)
WITH (p) as graph
CALL pagerank.get(graph, …) YIELD node, rank
RETURN node, rank;

Solution

  • You are missing the project() function in your code. Here is the correct code:

    MATCH p=(n:Node)-[:CONNECTS_TO]->(m:Node)
    WITH project(p) as graph
    CALL pagerank.get(graph, …) YIELD node, rank
    RETURN node, rank;
    

    You can read more about project function in a blog post How We Designed and Implemented Graph Projection Feature on Memgraph website.