Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix: Clean Residual Edges from VDB During Entity Deletion#2290

Merged
danielaskdd merged 1 commit intoHKUDS:mainfrom
danielaskdd:delete-residual-edges
Oct 30, 2025
Merged

Fix: Clean Residual Edges from VDB During Entity Deletion#2290
danielaskdd merged 1 commit intoHKUDS:mainfrom
danielaskdd:delete-residual-edges

Conversation

@danielaskdd
Copy link
Collaborator

Fix: Clean Residual Edges from VDB During Entity Deletion

🐛 Problem

When deleting entities from the knowledge graph, the system was only removing nodes from the graph structure but not cleaning up associated edge data from, causing data inconsistencies between Graph DB and VDB.

  • Vector database (relationships_vdb)
  • Relation chunks storage (relation_chunks)

This resulted in orphaned edge is cause by manully editing entity name.

✅ Solution

This PR adds comprehensive edge cleanup logic before node deletion:

  1. Edge Tracking: Collect all edges connected to entities being deleted into a deduplicated set with normalized representation (sorted tuples for consistency)

  2. VDB Cleanup: Delete edge vectors fromrelationships_vdb using computed relationship IDs for both directions (src→tgt and tgt→src)

  3. Storage Cleanup: Remove relation chunk tracking data usingmake_relation_chunk_key

  4. Improved Logging:

    • Fixed edge direction in warning message ({src} <-- {tgt} instead of{tgt} --> {src})
    • Added info log showing number of cleaned residual edges

📝 Changes

  • File:lightrag/lightrag.py
  • Location: Entity deletion logic in the cleanup process
  • Lines Modified: ~30 lines added/modified

🧪 Testing

Tested with entity deletion scenarios to verify:

  • All edge data is properly cleaned from VDB
  • Relation chunk storage is correctly updated
  • No orphaned data remains after deletion
  • Log messages provide clear feedback

…hips- Track edges to delete in set- Clean VDB before node deletion- Remove from relation chunks storage- Prevent orphaned relationship data
@danielaskdddanielaskdd merged commit94cdbe7 intoHKUDS:mainOct 30, 2025
1 check passed
@danielaskdddanielaskdd deleted the delete-residual-edges branchOctober 30, 2025 18:49
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@danielaskdd

Comments


[8]ページ先頭

©2009-2026 Movatter.jp