Jaroslav, you could use shortestPath or allShortestPaths
right now you do an expand over everything. There is also an expandPath procedure in apoc that could be helpful for you: https://neo4j-contrib.github.io/neo4j-apoc-procedures/#_expand_paths Michael On Mon, Aug 8, 2016 at 12:59 PM, Alan Robertson <[email protected]> wrote: > Hi Jaroslav, > > Although I need more sleep at the moment - your problem seems to have > similar issues to my question about a "query which returns a subgraph" > problem which I've been looking at... > > The problem I have with the * operator is that it can is *very* slow. You > also complain that it does redundant paths (which probably *explains* why > it's so slow). > > The problem I have with the shortestPath() function is that it doesn't > include all paths. > > I would imagine that if you really have all the flights in the world in > your database, that the arbitrary length paths would wind up including > every airport in the world. This may not be what you want ;-). > > You and I both want all paths, but all paths has problems... It visits the > same node multiple times. But shortestPath doesn't include all > relationships. > > This part of the problem seems to be the same. We want all paths, but with > each node occurring no more than once or twice... > > I can certainly see the need for a *-type operator (or function) that does > something more like this. > > My guess is that if you allow cycles, that you'll wind up with cycles in > the middle of the path as well as the one you say you want (cycles back to > the original airport). > > > > > On 08/08/2016 02:19 AM, Jaroslav Ramba wrote: > > Hi, > > I have graph of flights. I want find all flights between two airports > without cycles. How can I clean/disable result of cycles = repeated > sub-paths A-->B-->A-->B. > > OK *A-->B-->A* > NOT OK *A-->B-->A-->B* > > MATCH path=(source:Airport)-[flights:FLIGHT*]->(destination:Airport) > > Thank you for help > -- > 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. > > > > -- > > Alan Robertson / CTO > [email protected] / +1 303.947.7999 > > Assimilation Systems Limited > http://AssimilationSystems.com > > [image: Twitter] <https://twitter.com/ossalanr> [image: Linkedin] > <https://www.linkedin.com/in/alanr> [image: skype] > <https://htmlsig.com/skype?username=alanr_unix.sh> > > -- > 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.
