Skip to content

fix(graph): resolve edge creation failure due to vertex ID mismatch#331

Open
linmengmeng-1314 wants to merge 1 commit into
apache:mainfrom
linmengmeng-1314:fix/edge-vid-mapping
Open

fix(graph): resolve edge creation failure due to vertex ID mismatch#331
linmengmeng-1314 wants to merge 1 commit into
apache:mainfrom
linmengmeng-1314:fix/edge-vid-mapping

Conversation

@linmengmeng-1314
Copy link
Copy Markdown

Summary

  • Fix edge creation failure when loading extracted graph data into HugeGraph
  • The HugeGraph server assigns vertex IDs (e.g., 1:Sarah) using numeric label IDs, which differ from LLM-predicted IDs (e.g., person:Sarah) that edges reference
  • Add vid_mapping to track the ID mapping and update edge outV/inV after vertex creation

Problem

When using "Load into GraphDB" to import extracted graph data, edges fail to be created with java.lang.IllegalArgumentException. The root cause is that the LLM generates vertex IDs using label names (e.g., person:Sarah), but the HugeGraph server uses numeric label IDs (e.g., 1:Sarah). Edge references still point to the LLM-predicted IDs, causing vertex lookup failures.

Solution

  • Save original vertex ID before server creation
  • Build a mapping from original ID to actual server-assigned ID
  • Apply the mapping when creating edges (with fallback to original ID for backward compatibility)

Test plan

  • Extract graph data with an LLM
  • Load into GraphDB and verify both vertices and edges are created successfully
  • Verify existing functionality is not broken (when LLM predicts correct IDs)

🤖 Generated with Claude Code

When loading graph data, the HugeGraph server assigns vertex IDs
(e.g., "1:Sarah") that differ from LLM-predicted IDs (e.g., "person:Sarah").
This causes edge creation to fail with IllegalArgumentException because
the edge references use the original LLM-predicted IDs which don't
match actual vertex IDs in the graph.

Add a vid_mapping to track the ID mapping and update edge references
after vertex creation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels May 18, 2026
@github-actions github-actions Bot added the llm label May 18, 2026
@imbajin imbajin requested a review from Copilot May 18, 2026 13:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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

Labels

bug Something isn't working llm size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants