I have a graph of 100000 nodes connected to each other by a relation. From a point A to a point B, there is only one possible path, no loop is possible in my model.
I am looking for a solution that will indicate whether the path of a list of nodes intersects with the path of a second node list
I do not need to know the intersection points if there is an intersection.
Would it be possible to have a solution without going through the whole graph (stop once the first node is found) ?
example : picture of graph
list of nodes 1 : red nodes
list of nodes 2 : blue nodes
As there is at least one intersection(black node), the request must return true.
cypher request :
EDIT : cypher request
match path=shortestPath((n1)-[r*]-(n2))
where id(n1) = node1 and id(n2) in nodesList1
with nodes(path) as nodespath1
match path=shortestPath((n1)-[r*]-(n2))
where id(n1) = node2 and id(n2) in nodesList2
with nodespath1, nodes(path) as nodespath2
with ANY (n IN nodespath1 WHERE n IN nodespath2) AS conflit
with ANY (n IN collect(conflit) WHERE n = true) AS conflit
RETURN conflit;