Hi everyone.
I have this subgraph and I would like to count the number of isolated clusters.
I have tried using the weakly connected components algorithm from the GDS library but it returns a high number of components. I don't know if I am doing a mistake in the cypher projection. Basically, I want to return a subgraph of transactions between entities.
CALL gds.graph.create.cypher(
'my-cypher-graph',
'MATCH path = (t1:Payment)-[:HOP*3..10]->(t2:Payment)
WHERE (t1)<-[:MAKES]-(:User)<-[:AT]-(t2)
AND datetime(t1.createdAt)<datetime(t2.createdAt)
AND (((toFloat(t1.amount)-toFloat(t2.amount))/toFloat(t1.amount))<0.25)
AND datetime(t1.createdAt) > datetime("2020-01-01")
AND datetime(t2.createdAt) > datetime("2020-01-01")
UNWIND nodes(path) as t MATCH (e)-[:MAKES]->(t)
WHERE e:Client OR e:Commerce WITH t LIMIT 500
RETURN distinct id(t) as id',
'MATCH (t:Payment)-[:HOP]->(t2:Payment)
WHERE (t)<-[:MAKES]-(:User)<-[:AT]-(t2)
AND datetime(t.createdAt)<datetime(t2.createdAt)
AND (((toFloat(t.amount)-toFloat(t2.amount))/toFloat(t.amount))<0.25)
AND datetime(t.createdAt) > datetime("2020-01-01")
AND datetime(t2.createdAt) > datetime("2020-01-01")
RETURN distinct id(t) AS source, id(t2) AS target', {validateRelationships:false})
I thought that using the GDS library could be the approach but I am open to a different solution
Thanks!