Есть ли способ создать ограничение в neo4j, чтобы избежать создания циклов / циклов между узлами в neo4j
I have four nodes A,B,C,D and relationship between them as
A->B
B->C
C->D
now a relationship from
D->A will create as cycle . But i want to throw error if i try to create a relationship from D->A
CREATE (a:TEST {name:'A'})
CREATE (b:TEST {name:'B'})
CREATE (c:TEST {name:'C'})
CREATE (d:TEST {name:'D'})
CREATE (e:TEST {name:'E'})
create (a)-[:REL]->(b)
create (b)-[:REL]->(c)
create (c)-[:REL]->(d)
create (d)-[:REL]->(e)
return a,b,c,d,e
Вставка узлов и создание связей. После этого
MATCH (d:TEST {name:'E'}), (a:TEST {name:'A'})
WHERE NOT exists((a)-[:REL*]->(d))
WITH d, a
CREATE (d)-[:REL]->(a)