Grapheneer
Grapheneer

Reputation: 947

Neo4j CYPHER query for multiple path correlation search

I try to do correlation search in Neo4j. I created a simplified example graph (s. image). The question could be:

Is there any correlation between the city a user lives in, the car type, the factory it was produced in and the issue type? So is there any combination that appears more often than all the others? E.g. Users from Munich with a BMW that was produced in Factory XY are likely to have Quality Issues.

In CYPHER I could write the following code:

MATCH (c:City)<--(u:User)-->(car:Car)-->(f:Factory)
RETURN c.name, u.name, car.brand, f.name, count(*)
ORDER BY count(*) DESC

But if my path should go into both directions from the Car-Node and include the Issue Type, how can I write the code?

Graph

Upvotes: 1

Views: 160

Answers (1)

logisima
logisima

Reputation: 7478

Are you searching how to split a pattern like this :

MATCH (c:City)<--(u:User)-->(car:Car),
      (car)-->(f:Factory),
      (car)-->(it:IssueType)
RETURN c.name, u.name, car.brand, f.name, it.name, count(*)
ORDER BY count(*) DESC

Cheers

Upvotes: 1

Related Questions