Nitin J
Nitin J

Reputation: 78

filter vertices on number of outgoing edges in gremlin titan in java

I want to query and filter all vertices with more than 500 outgoing edges in titan using gremlin in java...how do i do this?I have started off as below

    pipe=pipe.start(graph.getVertices());

Upvotes: 1

Views: 977

Answers (1)

stephen mallette
stephen mallette

Reputation: 46216

You then need a filter function

p.start(
  g.getVertices()
   .filter(new PipeFunction<Vertex,Boolean>() {    
             public Boolean compute(Vertex v) {
               // write your logic here to count edges on the vertex and 
               // return true if over 500 and false otherwise
             }));

Using GremlinPipeline in Java is described more here

Upvotes: 2

Related Questions