2

Using python, bulbs, and rexster

Say I have two vertices, v0 and v1. And I create 3 outgoing edges from v0 -to-> v1. Currently in bulbs, list(v0.outV()) gives me a 3 element list, all of v1. Is there a way to get the unique list of v0.outV() in bulbs or gremlin?

Note: set(list(v0.outV())) doesn't work, and I prefer not to remove duplicates in python, but rather on the graph server, rexster side

Edit: I'm using rexster with orientDB, and orientDB is blueprint compatible.

Derek
  • 11,980
  • 26
  • 103
  • 162

2 Answers2

1

If you are issuing Gremlin I would guess dedup is the right step for you:

v0.outV().dedup

You can read more about it here:

http://gremlindocs.com/#filter/dedup

stephen mallette
  • 45,298
  • 5
  • 67
  • 135
1

Use Gremlin...

>>> from bulbs.rexster import Graph
>>> g = Graph()
>>> script = "g.v(vid).outV().dedup"
>>> params = dict(vid=1234)
>>> vertices = g.gremlin.query(script, params)
>>> vertices.next()    # or list(vertices) to convert the iterator to a list

See the Bulbs Gremlin docs...

espeed
  • 4,754
  • 2
  • 39
  • 51