0

I'm trying to output vertices's that had a same edge properties (weight:0.4) from the created in the modern graph.

gremlin> graph = TinkerFactory.createModern()

Thanks.

2 Answers2

2

Here's one way to get the list of vertices that has at least one outgoing "created" edge with a "weight" value of "0.4":

gremlin> g.V().filter(outE('created').has('weight',0.4d))
==>v[1]
==>v[4]
stephen mallette
  • 45,298
  • 5
  • 67
  • 135
0

That's a very limited example. I am guessing you are asking how to create and query edge properties. If that is so, here is an example of creating an edge with properties:

graph = TinkerFactory.createModern();
v1 = graph.addVertex();
v2 = graph.addVertex();
e = v1.addEdge("LABEL", v2);
e.property("weight", "0.4");

Then querying for an edge with that property:

graph.traversal().E().has("weight", "0.4").toList();
Filipe Teixeira
  • 3,565
  • 1
  • 25
  • 45
  • I think the question means that the user needs vertices having edges with the 'created' edge label and weight of 0.4 – Prachi Feb 04 '16 at 22:07