I dont think there is a way to match every duplicate and then delete them, you have to do it manually each dupliate. For example :
postgres=# SELECT * FROM cypher('test_graph', $$
CREATE (u:user {name: 'user'})
RETURN u $$) AS (u agtype);
u
-----------------------------------------------------------------------------------
{"id": 1125899906842625, "label": "user", "properties": {"name": "user"}}::vertex
(1 row)
postgres=# SELECT * FROM cypher('test_graph', $$
CREATE (u:user {name: 'user'})
RETURN u $$) AS (u agtype);
u
-----------------------------------------------------------------------------------
{"id": 1125899906842626, "label": "user", "properties": {"name": "user"}}::vertex
(1 row)
here we create to identical vertices but as you can see the ID
is different so when we want to delete one of them we use :
SELECT * FROM cypher('test_graph', $$
MATCH (u)
WHERE id = 1125899906842625
DELETE u $$) AS (u agtype);
and with this we delete the specific vertex (or edge) that we want.