How to delete all vertices and edges of specific type that are connected to a specific vertex

Use case:
There is a schema that has vertices of type country and region that are connected by edge type country_region
For a specific country (id=US)
How to delete all regions connected to that country along with all the edges that were used to connect those regions to that country please?

Thanks!

Does an edge automatically get deleted when the vertex it is connected to is deleted? If so, then is the way to delete all vertices and edges of a specific type that are connected to a specific vertex (question above) to simply delete all the connected vertices (regions) and have the edges (country_region) deleted automatically at the same time?

Yes, your intuition is correct.
Edges are attached to their vertices, so removing either vertex will cause the edge to be deleted too.

1 Like