Questions tagged [gremlin]

Gremlin is the graph traversal language and virtual machine of Apache TinkerPop™

Gremlin is a graph traversal language and virtual machine, developed by Apache TinkerPop. Gremlin is designed to work with any TinkerPop-enabled graph system, such as Titan, OrientDB, Neo4j, RDF stores like Stardog and Blazegraph, and others.

For more information, see the most recent reference documentation for TinkerPop.

3522 questions
10
votes
3 answers

Add edge if not exist using gremlin

I'm using cosmos graph db in azure. Does anyone know if there is a way to add an edge between two vertex only if it doesn't exist (using gremlin graph query)? I can do that when adding a vertex, but not with edges. I took the code to do so from…
10
votes
1 answer

How do I connect to a remote Neo4j database using gremlin python?

From what I've read Neo4j implements apache tinkerpop which leads me to think I can use gremlin python and rather than connect to a gremlin server I can point the python code at a neo4j server and treat it like a gremlin server. However I can't find…
Alex Ward
  • 461
  • 4
  • 16
10
votes
1 answer

How to calculate aggregates for sub-trees in Gremlin?

I have a tree with many levels, where leaf nodes might have property "count". I want to calculate total count for each sub-tree, and cache those values in the root node of each sub-tree. Is that possible in Gremlin?
isobretatel
  • 3,812
  • 7
  • 34
  • 49
10
votes
3 answers

Choosing an appropriate way to use Neo4j in Python

I am currently using embedded python binding for neo4j. I do not have any issues currently since my graph is very small (sparse and upto 100 nodes). The algorithm I am developing involves quite a lot of traversals on the graph, more specifically DFS…
npobedina
  • 331
  • 3
  • 14
9
votes
1 answer

Use Gremlin to find the shortest path in a graph avoiding a given list of vertices?

I need to use Gremlin find the shortest path between two nodes (vertices) while avoiding a list of given vertices. I already have: v.bothE.bothV.loop(2){!it.object.equals(y)}.paths>>1 To get my shortest path. I was attempting something…
Brett Hannah
  • 4,307
  • 4
  • 30
  • 33
9
votes
1 answer

gremlin python - add multiple but an unknown number of properties to a vertex

I want to add more than one property to a vertex, but from the outset do not explicitly know what those properties might be. For example, say for one person to be added as vertex to the graph, we have the following property dictionary: Person 1 { …
Ian
  • 3,605
  • 4
  • 31
  • 66
9
votes
2 answers

How to get id and all properties from a vertex in gremlin?

I am using AWS Neptune with gremlin and I want to get the id of a vertex with all properties of the vertex in one query. How can I do this? I have tried g.V().hasLabel('file').valueMap(true) but the output is: { "fileSize": [ "9170" ],…
Christopher
  • 91
  • 1
  • 1
  • 3
9
votes
1 answer

how to commit changes on gremlin server using gremlin python

I am writing a script to create a graph on gremlin-server using the gremlin-python library. I could not find any good documentation for the library. This is the code structure with which I am experimenting: from gremlin_python …
Tushar Aggarwal
  • 827
  • 1
  • 10
  • 26
9
votes
1 answer

Adding data to JanusGraph database

I had to use JanusGraph to retrieve and add data to it from java program. But i don't know how do i connect to a particular graph of db.Below is the code that i am using to insert data in the db but when i try to see the data from gremlin console, i…
Srijan Sharma
  • 683
  • 1
  • 9
  • 19
9
votes
2 answers

How do I update a specific edge property using Gremlin/Titan/TinkerPop3?

The goal I have a simple enough task to accomplish: Set the weight of a specific edge property. Take this scenario as an example: What I would like to do is update the value of weight. Additional Requirements If the edge does not exist, it should…
Double M
  • 1,449
  • 1
  • 12
  • 29
9
votes
1 answer

Best way to find a shortest path between two nodes in Tinkerpop 3.1

I know this was asked several time but I haven't found any reference regarding the last version of Tinkerpop (3.1), featuring many new useful functions we can use in our traversals. Let's say I have to find a shortest path between nodes 3 and 4. Is…
Alberto
  • 597
  • 3
  • 17
8
votes
2 answers

Sort/filter nodes based on relation properties

Given the following graph: How do I get the nodes adjacent to node[5] with weight > 50? How do I get the nodes adjacent to node[5] with label "knows", sorted by weight?
zsquare
  • 9,916
  • 6
  • 53
  • 87
8
votes
1 answer

What is the meaning InV step in gremlin terminology?

in particular following the tutorial here: https://kelvinlawrence.net/book/Gremlin-Graph-Guide.html#walk (3.3.2) I do not understand this statement outE().inV() Taken from g.V().has('airport','code','LCY').outE().inV().path() The explanation…
MaatDeamon
  • 9,532
  • 9
  • 60
  • 127
8
votes
2 answers

Is there a way of using Gremlin within an asyncio Python application?

The TinkerPop documentation describes GLV for Python. However, the examples presented in there are built around synchronous code. There is the aiogremlin library that was desingned to enable use of Gremlin in Python's asyncio code. Unfortunately,…
skalski
  • 111
  • 1
  • 6
8
votes
3 answers

Best way to parse a Gremlin.Net response?

What is the best way to get POCO's from a Gremlin.Net response? Right now I manually cast to dictionaries: var results = await gremlinClient.SubmitAsync>("g.V()"); var result = results[0]; var properties =…
halllo
  • 858
  • 12
  • 25