查询两个顶点 ID 之间的边 ID
Querying edge ID between two vertex IDs
我有这个 User
顶点和 friends
边。我认识两个用户,他们是朋友,其中一个想与另一个解除好友关系。我应该如何删除给定顶点之间的边?
到目前为止 运行 both DELETE EDGE FROM :player1 TO :player2 WHERE @class = "friends"
and DELETE EDGE FROM :player2 TO :player1 WHERE @class = "friends"
(使用适当的参数 ofc. ) 以确保它被删除对我来说工作正常,但感觉 优雅 不够。
您应该能够在一个查询中完成:
DELETE EDGE friends FROM [:player1, :player2] TO [:player1, :player2]
如果你也有从一个顶点到它自己的边(例如从 player1 到 player1)并且你不想删除它们,你可以添加一个条件:
DELETE EDGE friends FROM [:player1, :player2] TO [:player1, :player2]
WHERE out <> in
我有这个 User
顶点和 friends
边。我认识两个用户,他们是朋友,其中一个想与另一个解除好友关系。我应该如何删除给定顶点之间的边?
到目前为止 运行 both DELETE EDGE FROM :player1 TO :player2 WHERE @class = "friends"
and DELETE EDGE FROM :player2 TO :player1 WHERE @class = "friends"
(使用适当的参数 ofc. ) 以确保它被删除对我来说工作正常,但感觉 优雅 不够。
您应该能够在一个查询中完成:
DELETE EDGE friends FROM [:player1, :player2] TO [:player1, :player2]
如果你也有从一个顶点到它自己的边(例如从 player1 到 player1)并且你不想删除它们,你可以添加一个条件:
DELETE EDGE friends FROM [:player1, :player2] TO [:player1, :player2]
WHERE out <> in