Let's review a graph query example posted on gremlin-users mailing list:

Let the input vertices be v2, v3 and v4, and now find those vertices, that have the most outgoing edges to the aforementioned vertices:

gremlin> g = TinkerFactory.createClassic()
==>tinkergraph[vertices:6 edges:6]
gremlin> input = g.V(2,3,4).toList()
gremlin> sm = g.of().inject(input).unfold().in().groupCount().next().sort { -it.getValue() }
gremlin> m = sm.iterator().next().getValue()
gremlin> result = sm.grep { it.getValue() == m }*.getKey()

What do you think about the example? Does this look familiar? If you didn't read the description of the query, would you have guessed what it's going to return?

Let's chop it piece by piece and learn the API by the example.

results matching ""

    No results matching ""