How to include shortest path for like query

cypher
knowledge-base
(Sucheta) #1

Hi,

I want to find multiple shortest paths on one single screen or for example i want to show the path of all the nodes with the name return in them that is done using the like query.

I tried to create it but i was unsuccessful and was getting error.
[1]

    MATCH  p = shortestPath((ms  {name:"creationDateTime"})-[*]-(cs)) WHERE cs.name =~'(?i).*return.*' WITH p  RETURN p 

[2]

   MATCH (ms  {name:"creationDateTime"}),(cs) WHERE cs.name =~'(?i).*return.*', p = shortestPath ((ms)-[*]-(cs)) WITH p  RETURN p 

[3]

     MATCH  (from {name:'creationDateTime'}), (to {name:'return'}),  
     path = shortestPath ((from)-[r*]->  (to)) UNWIND nodes(path) AS stopNode
     OPTIONAL MATCH p= (stopNode   {name:'creationDateTime'})-[sb]->(schedule) WHERE 
      schedule.name =~'(?i).*return.*'   RETURN p 

Please help me create a correct query where i get all the nodes with the name "return" in them connected to "creationDateTime"

0 Likes