pnevyk / gryf

Graph data structure library aspiring to be convenient, versatile, correct and performant.
MIT License
69 stars 1 forks source link

Support id types that are not integers in `CompactIdMap` #75

Open pnevyk opened 4 months ago

pnevyk commented 4 months ago

After #74, it methods converting from an id to an integer (if supported) were lifted to IdType, leaving IntegerIdType just a marker trait. Thanks to that CompactIdMap can now support all id types using the current implementation for integer ids and a "map: id -> usize" (not implemented yet) implementation for the others. The internals of the CompactIdMap should be structured that there are multiple backends (isomorphic, vec, map) and the most appropriate one is picked during CompactIdMap initialization and stored into it as an enum variant. When a method on CompactIdMap is called, it is simply delegated to the method implementation of the backend.

Some notes: