1

How do I query Janus Graph to get all the vertices with a certain label?

This is the way I'm currently doing it. Where MAX is simply some arbitrary constant of the maximum theoretical size of the graph.

graph.V().hasLabel("my-label").next(MAX)

The other alternative is next() with no parameters but then I would have to iterate through using hasNext() until hasNext() is false. Is there any way to find all the vertices (return a list or array of type Vertex) matching a certain label without having to artificially set the search ceiling?

franklin
  • 1,800
  • 7
  • 32
  • 59

1 Answers1

3

You would use toList():

g.V().hasLabel("my-label").toList()
stephen mallette
  • 45,298
  • 5
  • 67
  • 135