Skip to content

fix: Fixed duplicated nodes and edges from multi-label nodes #125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2025

Conversation

flora-jin
Copy link
Contributor

There was a bug where multi-label nodes would duplicate edges as the function

findFromAndToLabels(edgeStructure)

(which looks at a specific edge type in the graph database to see what kinds of nodes it connects, creating a list of all the
different from-to label pairs for that relationship) used nested for loops to go through all combinations of fromLabel and toLabel arrays. When nodes had multiple labels, this created duplicate edge directions since each label combination would generate a separate entry in edgeStructure.directions, even if the actual relationship between the node types was the same.

Also, the function

getNodeNames()

(which gets all the different node types in the graph database by querying for all nodes and their labels, then adds
each label to the schema structure) generated duplicated nodes in the generated schema as the original code was processing node labels without checking for duplicates, causing the same node label to be added multiple times
to schema.nodeStructures.

The fix creates a new empty set every time the function is called to store every processed edge or node in order to check that it has not been previously processed.

@flora-jin flora-jin requested a review from andreachild August 7, 2025 01:55
@andreachild andreachild merged commit 8ecba76 into aws:main Aug 13, 2025
3 checks passed
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.

3 participants