Skip to content

Commit 8511eb5

Browse files
Update graphgen/models/storage/graph/kuzu_storage.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 174c47c commit 8511eb5

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

graphgen/models/storage/graph/kuzu_storage.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -375,16 +375,11 @@ def delete_node(self, node_id: str):
375375

376376
def get_neighbors(self, node_id: str) -> List[str]:
377377
query = """
378-
MATCH (a:Entity {id: $id})-[:Relation]->(b:Entity)
379-
RETURN b.id
378+
MATCH (a:Entity {id: $id})-[:Relation]-(b:Entity)
379+
RETURN DISTINCT b.id
380380
"""
381381
result = self._conn.execute(query, {"id": node_id})
382-
neighbors = []
383-
while result.has_next():
384-
row = result.get_next()
385-
if row and len(row) >= 1:
386-
neighbors.append(row[0])
387-
return neighbors
382+
return [row[0] for row in result if row]
388383

389384
def clear(self):
390385
"""Clear all data but keep schema (or drop tables)."""

0 commit comments

Comments
 (0)