Relative Content

Tag Archive for pythongraphmemgraphdbfraud-preventionmemgraph

I want to expand all the nodes connected to a node in Memgraph using Memgraph Cypher

Basically, just like in networkx where you get all connected_components to a node, I want to replicate that in Memgeraph.
So basically if i have a node with a specific label ( lets say node named claims with CaseNumber:”SR02892923″ ) and there are other node types connected to it. The graph which I have is directed. So i want to expand all the nodes which are connected to that node indefinite ( until they cant be expanded no more)
I looked far and wide and didn’t found a viable solution. So I tried a workaround
Workaround
MATCH path=(c:claims {CaseNumber:"SR02892923"})-[r]->(m) WITH path MATCH path2=(n)-[e]->(m) WHERE n IN nodes(path) OR m IN nodes(path) WITH path2 MATCH path3=(n)-[e]->(m) WHERE n IN nodes(path2) OR m IN nodes(path2) WITH path3 MATCH path4=(n)-[e]->(m) WHERE n IN nodes(path3) OR m IN nodes(path3) WITH project(path4) as subgraph CALL weakly_connected_components.get(subgraph) YIELD node,component_id RETURN node,component_id;