Search code examples
gremlinamazon-neptunegremlin-server

Why AWS Neptune produce so many results for graph?


Graph

%%gremlin -p v,outE,inV,outE,inV,outE,inV,outE,inV,outE,inV,outE,inV,outE,inV,outE,inV,outE,inV -l 40 -le 40 -g Datagroup 

g.V().hasLabel('I-GPM').outE().inV().outE().inV().outE().inV().outE().inV().outE().inV().outE().inV().outE().inV().outE().inV().outE().inV().path().
by(valueMap().with(WithOptions.tokens)).by(label).limit(100000)

Why producing a graph like this generate #100000 results? Is there a way to optimize this while still producing the same graph?


Solution

  • The way that the graph-notebook decides what to display in terms of a visual rendering is based on any results that represent a path. So if the query yields 100,000 paths, it will try to render each of them visually. You can simplify your query hints however. You can remove the -p line if you change the query to use path().by(elementMap()).