The specialized Map type used in CostModel could also be applied to the HashMap<EdgeId, VertexId> maps in the adjacency matrix. Based on Nick's exploration, this gives a runtime improvement over basic HashMap for small HashMaps, and since that's the case with road networks (out edges are typically on the order of 2-4), we should see a large benefit from this.
Bonus points: create a generic enum SpecializedHashMap<K: Hash, V> that implements these optimizations for any arbitrary K, V.
The specialized Map type used in CostModel could also be applied to the HashMap<EdgeId, VertexId> maps in the adjacency matrix. Based on Nick's exploration, this gives a runtime improvement over basic HashMap for small HashMaps, and since that's the case with road networks (out edges are typically on the order of 2-4), we should see a large benefit from this.
Bonus points: create a generic enum SpecializedHashMap<K: Hash, V> that implements these optimizations for any arbitrary K, V.