Search code examples
gremlinazure-cosmosdb-gremlinapi

Gremlin Query Language: how to drop every vertex that is not edged to anything?


As the title suggests. How do I drop every vertex that does not have any edges?


Solution

  • You could do:

    g.V().where(bothE().limit(1).count().is(lt(1)).drop()
    

    or perhaps:

    g.V().where(__.not(bothE())).drop()