Reputation: 91
Lets say there are sets of cars, airplanes... vertices with different colors
To get all the cars whose color is red:
1st approach : g.V().has(type, cars).has(color, red)
2nd approach g.V().and(().has(type, car), ().has(color, red))
which of the two approaches is optimal and why.
Upvotes: 1
Views: 34
Reputation: 6792
First approach is better.
Say for example you have 10 cars (5 are red) and 50 airplanes (25 are red). The first approach will traverse through 10 cars to find the 5 red cars. The second approach will traverse through 10 cars and 30 red things.
Upvotes: 1