b4lls4ck
Explore posts from serversATApache TinkerPop
•Created by b4lls4ck on 8/22/2024 in #questions
How to speed up gremlin query
Hi, I am working with Janusgraph and my query is taking a while to execute (around 2.8 seconds), but I would like it to be faster. I read that I should create a composite index to improve speed and performance or something of that sort, but I am unfamiliar with how to do that in Python.
Here is my query: g.V().has("person", "name", "Bob").outE("knows").has("weight", P.gte(0.5)).inV().values("name").toList()
What my query does is it finds all the nodes that Bob has relationship "knows" with, as long as the weight of the edge to those nodes are >=0.5. Bob has around ~600 nodes that it's connected to with the "knows" relationship. It's fairly slow and takes 2.5-2.8 secs to complete.
I would like to speed this up greatly, any ideas?
6 replies
ATApache TinkerPop
•Created by b4lls4ck on 8/1/2024 in #questions
How to find the edges of a node that have a weight of x or greater?
I have a graph with nodes that are connected to one another, and I have weights on the edges that connect these nodes.
On this query g.V().has("person", "name", "A").out("is friends with").values("name").to_list() returns the names of people that person "A" has the relation "is friends with". But I would like to filter by the weight value. Person A has a weight of 0.9 with Person B, and a weight of 0.7 with Person C. I would like to only get back the people person A has an edge with a weight of greater than 0.8, how can I do that? I am using gremlin-python. I have tried g.V().has("person", "name", "A").out("is friends with").has("weight", gte(0.8)) but I get an error saying NameError: name "gte" is not defined. Did you mean: 'g'?
8 replies
ATApache TinkerPop
•Created by b4lls4ck on 7/9/2024 in #questions
I am unsure on how to use Python to add graphs to JanusGraph
I am having a difficult time using python-gremlin. I am really unsure as to how I can create a graph, create vertices and edges, and then upload it to the database. Could someone provide a guide on how to do these things? I followed the JanusGraph tutorial as well as the Tinkerpop tutorials on how to use gremlin-python but nothing seems to be working for me.
42 replies