Skip to content

fix: handle KuzuDB dict-based results in Playground visualization#723

Open
tucaman wants to merge 1 commit intoCodeGraphContext:mainfrom
tucaman:fix/kuzudb-playground-edges
Open

fix: handle KuzuDB dict-based results in Playground visualization#723
tucaman wants to merge 1 commit intoCodeGraphContext:mainfrom
tucaman:fix/kuzudb-playground-edges

Conversation

@tucaman
Copy link
Copy Markdown

@tucaman tucaman commented Mar 14, 2026

Summary

  • KuzuDB returns plain Python dicts for nodes/rels, not Neo4j/FalkorDB objects
  • get_graph() in viz/server.py assumed object attributes (.labels, .id, .start_node)
  • Result: Playground shows all nodes but 0 edges with KuzuDB backend

Fix

  • Add _kuzu_id() helper to convert {'table': N, 'offset': M} to stable "N:M" string keys
  • Add isinstance(node, dict) / isinstance(rel, dict) branches in get_graph()
  • Use KuzuDB dict keys (_id, _label, _src, _dst) directly
  • All Neo4j/FalkorDB code paths preserved unchanged

Test Results

Metric Before fix After fix
Nodes 7,537 3,869
Edges 0 2,798

Edge types recovered: CONTAINS, IMPORTS, HAS_PARAMETER

Environment

  • CGC 0.3.1, kuzu 0.11.3, Python 3.12, Windows 11

Fixes #722

KuzuDB returns plain Python dicts for nodes and relationships, not
Neo4j/FalkorDB-style objects with .labels, .id, .start_node attributes.
This caused get_graph() to produce nodes with random IDs (Python memory
addresses) and 0 edges (source/target always None).

Add isinstance(node/rel, dict) checks to get_graph() that read _id,
_label, _src, _dst dict keys directly. Uses table:offset composite keys
for consistent node/edge ID matching. All existing Neo4j/FalkorDB code
paths are preserved unchanged.

Fixes CodeGraphContext#722
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 14, 2026

@tucaman is attempting to deploy a commit to the shashankss1205's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: Playground UI shows no edges when using KuzuDB backend

1 participant