Repository navigation
Support injectable vertex_id implementations - #43
Merged
bitwalker merged 3 commits intoDec 15, 2021
Merged
Conversation
bitwalker
force-pushed
the
zw/injectable-vertex-identities
branch
from
December 15, 2021 20:47
9b2bd32 to
a596873
Compare
Owner
|
Thanks! I've made some modifications and fixed up a few other chores on your branch, but preserved your changes and authorship. |
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.
While using libgraph I found myself building hash maps of
some_other_id => vertexto get map lookup performance in contexts where the id was a hash of a value in a struct/vertex rather than the whole vertex contents asGraph.Utils.vertex_id/1implements. In my case this was to maintain uniqueness of conditionals in a rule engine / match algorithm context where additional meta data in a vertex may vary but uniqueness of the actual conditional expression within was necessary.Rather than maintain the extra memory space of my own hash maps this PR lets these hash lookups be maintained as a single source of truth within Libgraph.
This PR does the following to address this use case
:vertex_identifieroption inGraph.new/1allowing injection of one's own unique identifier function of a vertex.Graph.Utils.vertex_id/1Please tell me if you have any questions or concerns - I'm not yet 100% sure this is a sane approach so feedback of any kind would be appreciated.