feat(cpp): Add map-based AddPropertyColumn overload for EdgesBuilder#932
Open
SYaoJun wants to merge 1 commit into
Open
feat(cpp): Add map-based AddPropertyColumn overload for EdgesBuilder#932SYaoJun wants to merge 1 commit into
SYaoJun wants to merge 1 commit into
Conversation
Introduce a new AddPropertyColumn overload that accepts unordered_map<pair<IdType, IdType>, any>, allowing users to set edge properties by (src, dst) key mapping instead of relying on insertion order. Edges not present in the map will not have the property set. Signed-off-by: Jason <libevent@yeah.net>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #932 +/- ##
============================================
- Coverage 81.00% 77.40% -3.61%
Complexity 615 615
============================================
Files 94 84 -10
Lines 10758 8958 -1800
Branches 1067 1070 +3
============================================
- Hits 8715 6934 -1781
+ Misses 1803 1784 -19
Partials 240 240
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Introduce a new
AddPropertyColumnoverload inEdgesBuilderthat acceptsunordered_map<pair<IdType, IdType>, any>, allowing users to set edge properties by(src_id, dst_id)key mapping.Why are the changes needed?
The existing
AddPropertyColumntakes avector<any>wherevalues[i]maps to the i-th edge in insertion order. This is fragile because it depends on the internal iteration order ofunordered_map(not guaranteed by the standard) and requires the user to know the exact insertion order of edges.The new map-based overload allows users to directly specify property values by
(src, dst)pair, which is more intuitive and robust. Edges not present in the map simply won't have the property set (written as null).Changes
edges_builder.h: Added newAddPropertyColumn(const std::string&, const unordered_map<pair<IdType,IdType>, any>&)overloadtest_builder.cc: Added test case covering 4 edges with 3 mapped values and 1 deliberately omitted