Hello,
I have the following case :
We are looking for fraud were 2 persons are connected to one car in one police case
and the same 2 persons are connected to 2 different cars in another police case.
The script for database creation :
CREATE (police1:PoliceFile {FileID:1})
CREATE (police2:PoliceFile {FileID:2})
CREATE (car1:Car {CarID:1})
CREATE (car2:Car {CarID:2})
CREATE (car3:Car {CarID:3})
CREATE (inv1:Involved {PesronID:1})
CREATE (inv2:Involved {PesronID:2})
CREATE (cl1:Claim {ClaimID:1})
CREATE (cl2:Claim {ClaimID:2})
CREATE (police1)-[:ConnectedTo]->(car1)
CREATE (police2)-[:ConnectedTo]->(car2)
CREATE (police2)-[:ConnectedTo]->(car3)
CREATE (car1)-[:ConnectedTo]->(inv1)
CREATE (car1)-[:ConnectedTo]->(inv2)
CREATE (car2)-[:ConnectedTo]->(inv1)
CREATE (car3)-[:ConnectedTo]->(inv2)
CREATE (inv1)-[:ConnectedTo]->(cl1)
CREATE (inv1)-[:ConnectedTo]->(cl2)
CREATE (cl1)-[:ConnectedTo]->(police1)
CREATE (cl2)-[:ConnectedTo]->(police2)
I use the following query to find the ring :
MATCH p=(c3:Car)-[:ConnectedTo]-(inv2:Involved)-[:ConnectedTo]-(c2:Car)-[:ConnectedTo]-(p1:PoliceFile)-[:ConnectedTo]-(c1:Car)-[:ConnectedTo]-(inv1:Involved)-[:ConnectedTo]-(c3:Car)-[:ConnectedTo]-(p2:PoliceFile)
where ID(p1)<>ID(p2) and ID(inv1)<>ID(inv2)
return p
It works with the sample data, but in the real database with 2 million nodes it works hours and does not bring results back.
How should I change the query in order to efficiently find fraud rings in the database?
Thank you,
Boris