Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-27-2021 03:23 PM
MATCH (m ) -[r]- (n {nid:'123'}),
p = shortestPath((m)-[*..10]-(n))
WHERE NOT((m)-[:similar]-(n))
RETURN p limit 5
I want to find the shortest path between m and n, but they should not be linked by the relationship 'similar'. The query above will return 0 path, but if I remove the WHERE clause, it return all paths.
10-28-2021 04:17 PM
Do you get results if you use two separate matches, and keep the WHERE NOT clause associated with the first MATCH?
MATCH (m ) -[r]- (n {nid:'123'})
WHERE NOT((m)-[:similar]-(n))
MATCH p = shortestPath((m)-[*..10]-(n))
RETURN p limit 5
10-30-2021 11:22 AM
Still not, again only if I remove the WHERE clause.
10-30-2021 02:26 PM
Hi @lingvisa
What's the logic you are trying to implement?
Reading your query, m-r-n is already the shortest Path.
Am I missing something?
Bennu
10-30-2021 04:10 PM
I want to find shortest paths between two nodes, but exclude paths of a specific relationship 'similar'.
10-30-2021 04:20 PM
Hi!
So you wanna exclude :Similar from your paths?
Why isn't m queried with an specific property condition as well?
Bennu
All the sessions of the conference are now available online