Thanks Michael.

Playing around with this I note that I can also write:
.
.
UNWIND nodes as o
UNWIND nodes as p
MATCH path=(n)--(m)--(o)--(p)

Which is another case that I'm interested in.

Do you know whether anyone has written an Neo4j expression to address the 
travelling salesman problem ?
My spin is,   instead of looking at a property distance value,    to find, 
from a given set of nodes,   which node other provides the least node 
traversals to all other nodes...

Wayne 

On Saturday, 8 April 2017 10:22:33 UTC+1, Michael Hunger wrote:
>
> You can do
>
> MATCH (n:Entity) where n.name IN {names}
> WITH collect(n) as nodes
> UNWIND nodes as n
> UNWIND nodes as m
> MATCH path = allShortestPaths( (n)-[*..4]-(m) )
> RETURN path
>
>
> On Fri, Apr 7, 2017 at 11:12 PM, unrealadmin23 via Neo4j <
> [email protected] <javascript:>> wrote:
>
>>
>> Consider a number of arbitrary nodes,  A,B,C,D,E,F,.....
>>
>> I wish to return all of the shortest paths between these nodes.
>> The nodes may have many edges between them, but anticipate a maximum of 4.
>> The graph is complex and non hierarchical  (if this makes sense - any 
>> node may point to any other node). 
>> A typical node has the form:  match (n:Entity { name: 'xyz' })
>>
>> How would I write the match expression to return the shortest paths 
>> between the above nodes,  in no specific order ?
>>
>> Wayne
>>
>>
>>
>> -- 
>> 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] <javascript:>.
>> 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