thexpressive
thexpressive

Reputation: 9

TinkerPop3 - Finding the same properties between edge

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.

Upvotes: 0

Views: 220

Answers (2)

stephen mallette
stephen mallette

Reputation: 46206

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]

Upvotes: 2

Filipe Teixeira
Filipe Teixeira

Reputation: 3565

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();

Upvotes: 0

Related Questions