Skip to content

Support injectable vertex_id implementations - #43

Merged
bitwalker merged 3 commits into
bitwalker:masterfrom
zblanco:zw/injectable-vertex-identities
Dec 15, 2021
Merged

bitwalker merged 3 commits into
bitwalker:masterfrom
zblanco:zw/injectable-vertex-identities

Conversation

@zblanco

@zblanco zblanco commented Nov 26, 2021 •

Copy link
Copy Markdown
Contributor

While using libgraph I found myself building hash maps of some_other_id => vertex to 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 as Graph.Utils.vertex_id/1 implements. 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

  • Supports a :vertex_identifier option in Graph.new/1 allowing injection of one's own unique identifier function of a vertex.
    • Defaults to existing Graph.Utils.vertex_id/1
  • Bumps dependencies to allow eqc_ex to run property tests locally with Quviq/eqc_ex@43759ba .
  • Test and doctest showing intended use of custom vertex identifier.
  • Runs formatter

Please 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.

@bitwalker
bitwalker force-pushed the zw/injectable-vertex-identities branch from 9b2bd32 to a596873 Compare December 15, 2021 20:47
@bitwalker
bitwalker merged commit f033439 into bitwalker:master Dec 15, 2021
@bitwalker

Copy link
Copy Markdown
Owner

Thanks! I've made some modifications and fixed up a few other chores on your branch, but preserved your changes and authorship.

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.

2 participants