I need to find connections between all the nodes (with a "Hashtag" label) connected to the main user node.
So far, I came up with a solution like this, but it seems to me a bit inefficient, because I traverse the graph twice to first find c1 and then c2.
Anybody has better ideas?
MATCH (u:User{uid:"777"}), (c1:Hashtag), (c2:Hashtag),
c1-[:BY]->u, c2-[:BY]->u, c1-[rel:TO]->c2 RETURN rel,c1,c2;
(I'm working with Neo4J / Cypher 2.0)
Try this, play around with it and let me know the output.
MATCH (u:User {uid:"777"})
WITH u
MATCH u<-[:BY]-(c1:Hashtag)-[rel:TO]-(c2:Hashtag)--(u)
RETURN rel, c1, c2
Basically, the idea here is as follow:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.