Apparently there are 2 possible ways this query can go depending on your graph, I have discovered this after experimentation.
1.) If your graph only contains isolated vertices with the label useless, all of them will be deleted.
2.) If your graph contains any (even a single one) non-isolated vertex with this label, no vertices at all will be deleted.
Let's confirm this behavior: -
We create 3 isolated vertices with the label Useless, numbered 1, 2, and 3.
test=# SELECT * FROM cypher('test', $$
CREATE (:Useless {number:1}), (:Useless {number:2}), (:Useless {number:3}) $$) as (type agtype);
type
------
(0 rows)
They are deleted just fine.
test=# SELECT * FROM cypher('test', $$
MATCH(n:Useless) delete n
$$) as (type agtype);
type
------
(0 rows)
Next we create 4 vertices with the same label with an edge between 2 of them.
test=# SELECT * FROM cypher('test', $$
CREATE (:Useless {number:1}), (:Useless {number:2}), (:Useless {number:3})-[:UselessStill]->(:Useless {number:4})
$$) as (type agtype);
type
------
(0 rows)
Trying to delete them: -
test=# SELECT * FROM cypher('test', $$
MATCH(n) DELETE n
$$) as (type agtype);
2023-05-13 12:02:10.802 CEST [22412] ERROR: Cannot delete vertex n, because it still has edges attached. To delete this vertex, you must first delete the attached edges.
2023-05-13 12:02:10.802 CEST [22412] STATEMENT: SELECT * FROM cypher('test', $$
MATCH(n) DELETE n
$$) as (type agtype);
ERROR: Cannot delete vertex n, because it still has edges attached. To delete this vertex, you must first delete the attached edges.
How do we know no vertices were deleted?
Let's query: -
MATCH(n) RETURN n
$$) as (type agtype);
type
-----------------------------------------------------------------------------------
{"id": 6755399441055745, "label": "Useless", "properties": {"number": 1}}::vertex
{"id": 6755399441055746, "label": "Useless", "properties": {"number": 2}}::vertex
{"id": 6755399441055747, "label": "Useless", "properties": {"number": 3}}::vertex
{"id": 6755399441055748, "label": "Useless", "properties": {"number": 4}}::vertex
(4 rows)
I just checked in neo4j and it in indeed the desired behavior, since neo4j works the same way.
Adding 4 vertices with 1 edge in between.

Attempting a delete

Still the same
