I rewrote the query by changing the depth to 2 as follows. I am getting a 
slight speed-up but not significant. I would appreciate any ideas. 

MATCH (n:User{id:'id'}) - [:HAS_FAX_NUMBER] -> () <-[:HAS_FAX_NUMBER]-(m1) 
MATCH p = allShortestPaths((n)-[*..2]-(m1))
RETURN m1.fhid AS SuggestedUser, COUNT(p) as Connections
UNION
MATCH (n:User{id:'id'}) - [:HAS_PHONE_NUMBER] ->() < - [:HAS_PHONE_NUMBER] 
-(m2) MATCH p = allShortestPaths((n)-[*..2]-(m2))
RETURN m2.fhid AS SuggestedUser, COUNT(p) as Connection


On Friday, July 18, 2014 3:40:15 PM UTC-4, Alx wrote:
>
> I have the following cypher query:
>
> MATCH (n:User{id:'id'}) - [:HAS_FAX_NUMBER] -> () <-[:HAS_FAX_NUMBER]-(m1) 
> MATCH p = allShortestPaths((n)-[*]-(m1))
> RETURN m1.fhid AS SuggestedUser, COUNT(*) as Connections
> UNION
> MATCH (n:User{id:'id'}) - [:HAS_PHONE_NUMBER] ->() < - [:HAS_PHONE_NUMBER] 
> -(m2) MATCH p = allShortestPaths((n)-[*]-(m2))
> RETURN m2.fhid AS SuggestedUser, COUNT(*) as Connection
>
> This query is quite slow: 3 mins. Is there a way to speed this up? I am 
> basically try to find the how connected is the user in question with m1 or 
> m2. There might be another approach to this. Any ideas or suggestions? Thanks 
> in advance!
>
>
>
>

-- 
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