0

I have an application with more than 3000 vertices having the same label , let's say ABC. It is required for my application to get the list of all the vertices and their properties for the user to choose the entity and interact with it. For that I am writing a GetAllVertices query for label ABC.

The id's of the vertices are numbers Ex: 1,2,3,..

The following query returns the correct amount of vertices ~ 3000

g.V().hasLabel('ABC').dedup().count()

The following query however only returns around 1600 entries

g.V().hasLabel('ABC').elementMap()

I am trying to understand what is happening and how can I get the elementMap for all the vertices that I am interested in. I think it might be because of the hash function elementMap() might be using that is causing the collision of the keys and thus resulting in overwriting some of the keys with different entries.

Kelvin Lawrence
  • 14,674
  • 2
  • 16
  • 38

1 Answers1

0

Using TinkerGraph I am not able to reproduce this behavior.

gremlin> g.inject(0).repeat(addV('ABC').property(id,loops())).times(3000)
==>v[2999]
gremlin> g.V().hasLabel('ABC').count()
==>3000
gremlin> g.V().hasLabel('ABC').elementMap().count()
==>3000 

If you can say more about the data in your graph I can do some additional tests and try to reproduce what you are seeing.

UPDATED 2022-08-03

I ran the same test on Amazon Neptune version 1.1.1.0.R4 from a Neptune notebook, and it worked there as well.

%%gremlin
g.inject(0).repeat(addV('ABC').property('p1',loops())).times(3000)

v[a6c131cc-42e8-3713-c82d-faa193b118a0]

%%gremlin
g.V().hasLabel('ABC').count()

3000

%%gremlin
g.V().hasLabel('ABC').elementMap().count()

3000
Kelvin Lawrence
  • 14,674
  • 2
  • 16
  • 38
  • I created a test db and uploaded the data there, there it seemed to be working properly, the only difference I can see between the two db's ( my primary and test ) is that the primary did not have any reader instance, but I don't think that should cause any issues. If it does it would be interesting to see what is happening. – Shubham Uttarwar Aug 04 '22 at 00:10