I think you create a cross product of your 150k players: which is around 22 
billion combinations.

I rather think this makes more sense:

> match (p:Player)-[:PLAYS_IN]->(t:Team)
with distinct t, collect(p) as players
> MATCH (t)-[:PLAYED]->(g:Game)<-[:PLAYED]-(tt:Team)
with distinct tt, players
> match (tt)<-[:PLAYS_IN]-(pp:Player) 
unwind players as p
> return p.Lastname, pp.Lastname, count(*) as frequency

> order by frequency desc

> limit 100;

Michael

Am 14.07.2014 um 12:00 schrieb Michael Hauck <[email protected]>:

> Hi,
> 
> my Graph question is:
> "Which Player played most frequently against each other"
> 
> I queried following Cypher:
> 
> match 
> (p:Player)-[:PLAYS_IN]->(t:Team)-[:PLAYED]->(g:Game)<-[:PLAYED]-(tt:Team)<-[:PLAYS_IN]-(pp:Player)
>  
> USING SCAN p:Player USING SCAN pp:Player  
> return p.Lastname, pp.Lastname, count(pp) order by count(pp) desc limit 100;
> 
> Number of 
> Player: 158310
> Game: 215068
> Team: 218960
> 
> Heap is 6G, CPU are 4 cores.
> 
> This Query does take hours and does not finish.
> How should i optimize it?
> 
> Thanks,
> Michael
> 
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to