0

I'm currently using the apoc library to get the shortest path with a cost (length)

apoc.algo.aStar(
    startNode, endNode, 'KNOWS|<WORKS_WITH|IS_MANAGER_OF>', 
    'distance','lat','lon'
) YIELD path, weight

There are two things I need:

  1. How would I go about making it return all possible paths and not just the one?

  2. How would I make it only search egdes where PropertyA: true, PropertyB: false, PropertyC contains "abc", etc..?

The answer doesn't have to be using apoc but can be with CYPHER or C# please. Thanks

Liam
  • 439
  • 1
  • 4
  • 26
  • While that would be an epic and dramatic name, it's actually the APOC library (standing both for Awesome Procedures On Cypher, and referencing the character of Apoc from The Matrix). – InverseFalcon Aug 16 '18 at 19:44
  • Haha. Autocorrect on my phone. Fixed. – Liam Aug 16 '18 at 19:45

1 Answers1

1

In answering to your first question you can use allShortestPaths function. For your second question you can set a WHERE CONDITION or your relationship.

This is my try on my sample database:

MATCH path=allShortestPaths((:User)-[:MEMBER_OF_GROUP*1..3]-(:Group)) WHERE ALL(x in relationships(path) WHERE x.last_seen > 1534326850) RETURN path

You need add your path in allShortestPaths and for search on edges check path relations in WHERE CONDITION

mastisa
  • 1,875
  • 3
  • 21
  • 39