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 identifyingNodes 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.
Goal: Situate on generics usage for managing the main data types for graph components.
Currently I'm using
P
forPosition
andV
forValue
. Ideally I can formalize a way to describe data that can be used for identifyingNode
s in a graph by position. I could probably do that with something that implementsHash
so thatP
is always hashable to some interface with the underlying data structure.For example,
usize
works well early on as an index to an underlyingVec
. If that underlying data structure changesusize
should continue to work as a way to index someNode
.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.