CostUpdate
Typeclass: after a node is settled (dequeued and marked visited) and its neighbours have been offered to the frontier, optionally update the priorities of frontier entries that have improved.
This typeclass exists to support decreaseKey in Dijkstra- and Prim-style traversals. It keeps all domain knowledge (cost maps, edge weights, the notion of "improvement") out of Traversal itself.
For DFS and BFS the default no-op given is resolved automatically. For Dijkstra and Prim, the GraphTraversal implementation supplies a concrete given CostUpdate[W, IndexedPrioQueue] (where W = (E, V)) that closes over a secondary vertex→cost map and calls IndexedPrioQueue.decreaseKey for any neighbour whose cost has improved since it was first offered.
Type parameters
- F
- W
-
the frontier element type (e.g.
(E, V)for weighted traversals, or plainVfor DFS / BFS)
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any