0

Assume I have a graph with vertices that have property name, what is a good way to get Ids of all vertices that have the same name.

Extending this, if I have a graph with day and month properties, how to return IDs of these vertices that share the same values.

Mohamed Taher Alrefaie
  • 15,698
  • 9
  • 48
  • 66

2 Answers2

5

Assuming you don't know the value of the duplicates and you just want to find all duplicates possible:

Here is a quick and dirty solution for you. Use Group By, for example:

g.V().has("name").limit(50).group().by("name");

I only use limit because doing this operation on the whole graph will be very time consuming. For the day and month properties you can do the same thing.

Filipe Teixeira
  • 3,565
  • 1
  • 25
  • 45
0

Assuming you have created indices for these indexed properties before you created the vertices, then you can create a gremlin query like: def g = graph.traversal(); def vertices = g.V().has("name", "David").id();

This assumes you know the value you are searching for.

David
  • 486
  • 2
  • 9