diff --git a/search/internals.go b/search/internals.go index 9fd80126..a775e6cd 100644 --- a/search/internals.go +++ b/search/internals.go @@ -142,6 +142,20 @@ func (pq *aStarPriorityQueue) Exists(id int) bool { return ok } +type denseNodeSorter []gr.Node + +func (dns denseNodeSorter) Less(i, j int) bool { + return dns[i].ID() < dns[j].ID() +} + +func (dns denseNodeSorter) Swap(i, j int) { + dns[i], dns[j] = dns[j], dns[i] +} + +func (dns denseNodeSorter) Len() int { + return len(dns) +} + // General utility funcs // Rebuilds a path backwards from the goal.