2016-11-25 37 views

回答

2

沒有爲一個部門,我也不能用於模所知,沒有一步,但你可以使用了lambda:

g.V().outE().count().filter{count = it.get(); count % 2 == 1;} 

(注意這個查詢需要完全圖的掃描中最系統,因爲沒有使用索引。)

This post在Gremlin-users組中包含有關Gremlin的數學運算的更多信息。

3

沒有mod運算符的麻袋,但有div,mult和minus。

g.withSack(0).V().as('a').where(outE().count().sack(assign).sack(div).by(constant(2)).sack(mult).by(constant(2)).sack(minus).sack().is(0)) // even 

g.withSack(0).V().as('a').where(outE().count().sack(assign).sack(div).by(constant(2)).sack(mult).by(constant(2)).sack(minus).sack().is(neq(0))) // odd 
相關問題