Essentially, I'm trying to modify the following piece of Gremlin code such that instead of operating on a single vertex at a time - signified by g.V(1)
, it will work with multiple vertices at once (e.g. changing to g.V()
), while still only limiting the number of returned results per vertex to one (see limit(1)
).
g.V(1).repeat(out().simplePath()).until(has('color', 'red')).path().limit(1)
The above query will compute the shortest path from a given vertex to the closest vertex which has property(color)==red
.
However, I want to compute the shortest path for multiple vertices passed in at the same time, while still only returning a single path per vertex.
I'm having difficulty modifying this without returning multiple paths for the same vertex however.
gremlinpython
wrapper, and I want to minimize the number of queries to the gremlin-server, as each query can be time expensive. – Ian