1

I have a graph in which all Edges have the same property but values may differ between Vertices. I need to traverse through the graph from an specific vertex though all edges that have an specific value for that proerty.

For example I have this graph:

example graph

From Vertex: A traverse through all vertices where the edges color == blue. The expected answer should be: [A, B, D, C, H, G]

valdo
  • 11
  • 1
  • I was trying something like this: ``g.V('A').until(has("color", neq("blue"))).repeat(outE()).inV().dedup()`` – valdo Nov 15 '18 at 00:06
  • 1
    the picture is nice, but when asking questions about Gremlin a sample data script is even better - here is an example https://stackoverflow.com/questions/51388315/gremlin-choose-one-item-at-random – stephen mallette Nov 15 '18 at 00:20

1 Answers1

1

The query you've tried only checks vertex properties and it makes blue a break condition, not a continuation condition.

This is what you're looking for:

g.V('A').emit().repeat(outE().has("color", "blue").inV().dedup())
Daniel Kuppitz
  • 10,846
  • 1
  • 25
  • 34