Hello,
I've tried using the apoc.path.expandConfig to find a path.
I've called it twice with different sequence and if the second one didn't find any path, it "deleted" the result of the first apoc.
For example - The graph
CREATE (n:Person:TrailStart)-[:FRIEND_OF]->(:Person)-[:FRIEND_OF]->(:Person)-[:FRIEND_OF]->(:Person:TrailEnd)
The queries -
This one returned the path as expected
MATCH (end_node:TrailEnd)
WITH collect(end_node) as end_nodes
MATCH (start_node:TrailStart)
CALL apoc.path.expandConfig(start_node, {
endNodes: end_nodes,
sequence: '+person, FRIEND_OF>'
}) YIELD path as path1
RETURN path1
This one return nothing
MATCH (end_node:TrailEnd)
WITH collect(end_node) as end_nodes
MATCH (start_node:TrailStart)
CALL apoc.path.expandConfig(start_node, {
endNodes: end_nodes,
sequence: '+person, FRIEND_OF>'
}) YIELD path as path1
CALL apoc.path.expandConfig(start_node, {
endNodes: end_nodes,
sequence: '+person, NOT_FRIEND_OF>'
}) YIELD path as path2
RETURN path1
If the second apoc procedure did find something, the result of the first procedure wasn't deleted.
Thank you,
Michael