0

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?

Kelvin Lawrence
  • 14,674
  • 2
  • 16
  • 38
48bits
  • 15
  • 3

1 Answers1

0

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

Kelvin Lawrence
  • 14,674
  • 2
  • 16
  • 38
  • Is there a way to know why I am producing so many paths for such a graph? I have multiple properties for each vertex, could this be the reason? Also, I did not import the data as a CSV file into Neptune instead I added them via a code format addV("Retained_Customer"). property(id,"PAGE_k3"). property("Datagroup","KPI"). property("Description","xx"). property("Team","AC"). property("Chart_Name","Customer_retention"). property("Frequency","Monthly"). property("Filter_Name","By Dealer Group / By Area Manager / By Region /By Dealer"). as("PAGE_k3"). – 48bits Dec 15 '21 at 02:55
  • Your query as written is going to return all of the possible paths up to a limit of 100,000 including any that include cycles. If you have cycles in your graph, and you don't want them in the results, adding a `simplePath` step to the query should help. A cycle is a case such as `A->B->C->A` – Kelvin Lawrence Dec 15 '21 at 15:46