imbajin commented on code in PR #101:
URL:
https://github.com/apache/incubator-hugegraph-ai/pull/101#discussion_r1839743727
##########
hugegraph-llm/src/hugegraph_llm/operators/hugegraph_op/graph_rag_query.py:
##########
@@ -192,18 +191,19 @@ def _format_graph_query_result(self, query_paths) ->
Tuple[Set[str], List[Set[st
subgraph = set()
subgraph_with_degree = {}
vertex_degree_list: List[Set[str]] = []
+ global_vertex_cache: Set[str] = set()
Review Comment:
use a short name like `v_cache`? same as `e_cache`
##########
hugegraph-llm/src/hugegraph_llm/operators/hugegraph_op/graph_rag_query.py:
##########
@@ -229,15 +230,20 @@ def _process_path(self, path: Any, use_id_to_match: bool)
-> Tuple[str, List[str
def _process_vertex(self, item: Any, flat_rel: str, node_cache: Set[str],
prior_edge_str_len: int, depth: int,
nodes_with_degree: List[str],
- use_id_to_match: bool) -> Tuple[str, int, int]:
+ use_id_to_match: bool, global_vertex_cache: Set[str])
-> Tuple[str, int, int]:
matched_str = item["id"] if use_id_to_match else
item["props"][self._prop_to_match]
if matched_str in node_cache:
flat_rel = flat_rel[:-prior_edge_str_len]
return flat_rel, prior_edge_str_len, depth
node_cache.add(matched_str)
props_str = ", ".join(f"{k}: {v}" for k, v in item["props"].items())
- node_str = f"{item['id']}{{{props_str}}}"
+ # TODO: we may remove label id or replace with label name
+ if matched_str in global_vertex_cache:
+ node_str = f"{item['id']}"
Review Comment:
```suggestion
node_str = matched_str
```
--
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]