cnpryer / solver

A work-in-progress solver library for Rust.
MIT License
1 stars 0 forks source link

Generics and `Node` index abstraction #60

Open cnpryer opened 1 year ago

cnpryer commented 1 year ago

Goal: Situate on generics usage for managing the main data types for graph components.

Currently I'm using P for Position and V for Value. Ideally I can formalize a way to describe data that can be used for identifying Nodes in a graph by position. I could probably do that with something that implements Hash so that P is always hashable to some interface with the underlying data structure.

For example, usize works well early on as an index to an underlying Vec. If that underlying data structure changes usize should continue to work as a way to index some Node.

However I may want something different from usize in the future, but I don't want to sacrifice performance. Ideally I could provide the implementation for some hashable that creates sound bounding-defaults to fallback to.

cnpryer commented 1 year ago

cc #43