Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-11-2019 06:11 AM
Hi all,
I'm trying to get a parent graph out from my resultant sub graph, combining all common parts of sub graph path.
Like to know the best way to do it?
here the basic query:
MATCH path = (s:startPoint {id:'123'}) - [:CONNECTED*] - (e:endPoint)
RETURN path
In database there is multiple end points(count: 500).
That query giving me 500 path(s), where maximum of the paths using the same sub-route.
As a result it's giving me lots of duplicate nodes.
Right now I'm using the following query for getting the result I wanted.
But, I believe this can be improved.
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 comments.
All the sessions of the conference are now available online