Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-15-2019 02:33 AM
This is a network graph.
Nodes are connected to other nodes with CONNECTED relation.
MATCH path = (s:startPoint {id:'123'}) - [:CONNECTED*] - (e:endPoint)
WITH path
UNWIND relationships(path) as paths
with DISTINCT paths as distinctPath
MATCH p = () - [distinctPath] - ()
return p
11-15-2019 04:20 AM
Please describe a bit more about what you're trying to do with this query. It looks like you're trying to enumerate all possible 1-hop paths that are anywhere connected to the start point, but I don't really understand why you're doing that or why that's useful. Because all of the paths you're returning look like they're one hop, a different way of doing this would just be to return all the end points, and you'd end up with everything connected to the start point.
MATCH (s:startPoint {id:'123'}) - [:CONNECTED*] - (e:endPoint)
RETURN e
11-15-2019 06:08 AM
Here the explanation:
The graph I have created having:
5: startPoint
60000: intermediatePoints
5000: endPoint
55000: relations
I want know path to all endPoints connected with particular startPoint via intermediatePoints:
Here the query I was using:
MATCH path = (s:startPoint {id:'123'}) - [:CONNECTED*] - (e:endPoint)
RETURN path;
The problem with the above query is , for example suppose the startPoint is connected with 100 endPoints via intermediatePoints , so in that situation the query result will have 100 records.
And within that 100 records there will be lots of common sub-path.
for example:
one record: (sp1)->(ip1)->(ip2)->(ip3)->(ip4)->(ep1)
another record with common sub-path: (sp1)->**(ip1)->(ip2)->(ip3)**->(ep2)
common path: (ip1)->(ip2)->(ip3)
Hope you have clear vision about it now.
So, to remove those common sub-paths I'm using this query:
MATCH path = (s:startPoint {id:'123'}) - [:CONNECTED*] - (e:endPoint)
WITH path
UNWIND relationships(path) as paths
with DISTINCT paths as distinctPath
MATCH p = () - [distinctPath] - ()
return p
Please let me know your thoughts.
All the sessions of the conference are now available online