MrJs133 commented on code in PR #147:
URL: 
https://github.com/apache/incubator-hugegraph-ai/pull/147#discussion_r1898216482


##########
hugegraph-llm/src/hugegraph_llm/operators/hugegraph_op/fetch_graph_data.py:
##########
@@ -28,6 +28,12 @@ def __init__(self, graph: PyHugeClient):
     def run(self, context: Optional[Dict[str, Any]]) -> Dict[str, Any]:
         if context is None:
             context = {}
+        if "num_vertices" not in context:
+            context["num_vertices"] = 
self.graph.gremlin().exec("g.V().id().count()")["data"]
+        if "num_edges" not in context:
+            context["num_edges"] = 
self.graph.gremlin().exec("g.E().id().count()")["data"]
         if "vertices" not in context:
             context["vertices"] = 
self.graph.gremlin().exec("g.V().id().limit(10000)")["data"]
+        if "edges" not in context:
+            context["edges"] = 
self.graph.gremlin().exec("g.E().id().limit(100)")["data"]

Review Comment:
   After analysis, it has been determined that the `context` in question is a 
local variable and is not the same as the `context` being passed globally. 
   It has now been renamed to `graph_context`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to