Does the dataset have bidirectional friendship relationships? Or just one
relationship per friendship?
If the former, then removing the duplicate and ignoring the direction in
neo4j makes sense.

For a potentially faster query you could use:

*MATCH* *(*n*{*id *:* *{*id*}})-[:*CONNECTED*]-(f1)-[**:*CONNECTED*]-(f2)*

*WITH DISTINCT f2*

*MATCH (f2)**-[**:*CONNECTED*]-(f3)*

*WITH DISTINCT f3*

*MATCH (f3)**-[**:*CONNECTED*]-(f4)*

*WITH DISTINCT f4*

*MATCH (f4)**-[**:*CONNECTED*]-(*friend_of_friend*)*

*RETURN* *distinct* friend_of_friend*.*id


You can also try the new query optimizer that will be available soon by
prefixing your query with "cypher 2.1.experimental"


I can check the dataset.



On Sat, Nov 8, 2014 at 6:22 PM, Kamilos <[email protected]> wrote:

>
> hi, guys,
>>
> thx a lot for your help
> but unfortunately I don't have time right now to do the benchamark
> completely
>
> What I found out is that with the querry "friend of friends" at level 5,
> Neo4J is faster than mysql.
>
> I used the standford dataset from facebook to populate my db :
> http://snap.stanford.edu/data/egonets-Facebook.html
>
> The queries are
>
> Neo4j
>
> *MATCH* *(*n*{*id *:* *{*id*}})-[:*CONNECTED***1..5*]-(*friend_of_friend
> *)*
>
> *RETURN* *distinct* friend_of_friend*.*id
>
> Mysql
>
> *SELECT* *distinct* uid2
>
>   *FROM* edge
>
>  *WHERE* uid1 *IN* *(*
>
>        *SELECT* uid2
>
>          *FROM* edge
>
>         *WHERE* uid1 *in* *(* *SELECT* uid2
>
>                         *FROM* edge
>
>                         *WHERE* uid1 *in* *(*  *SELECT* uid2
>
>                                          *FROM* edge
>
>                                          *WHERE* uid1 *in*  *(*   *SELECT*
> uid2
>
>                                                             *FROM* edge
>
>                                                             *WHERE* uid1
> *= *?
>
>                                                          *)*
>
>                                        *)*
>
>                        *)*
>
>        *);*
>
>
>  --
> 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