I am currently using gremlin-python to study a graph. I want to get all vertices having more than two out edges. I am using anonymous traversal to filter out users based on the edge count but below is the error I am getting.
AttributeError: 'list' object has no attribute 'out'
I am new to this, not sure what I am doing wrong here. This is the way described in the limited gremlin-python tutorials/docs available.
It would be helpful if you could include a code snippet showing the imports you used as well as the query. In your Python code did you remember to import this class?
from gremlin_python.process.graph_traversal import __
I am able to run your query without any issues using one of my graphs
g.V().hasLabel('airport').where(__.out().count().is_(P.gte(2))).count().next()
If you do not have that import you will see an error like the one you are seeing.
There is a list of the most commonly needed imports when using gremlin-python at this location
EDITED to add:
As Stephen points out in the comment below given you only ever need to know if there are at least two outgoing edges you can reduce the work the query engine has to do (some optimizers may not need this) by adding a limit
step.
g.V().hasLabel('airport').where(__.out().limit(2).count().is_(P.gt(1))).count().next()