3 type nodeMaxHeap struct {
5 lessFunc func(*NodeInfo, *NodeInfo) bool
9 func (h nodeMaxHeap) Len() int {
13 func (h nodeMaxHeap) Swap(i, j int) {
14 h.nodes[i], h.nodes[j] = h.nodes[j], h.nodes[i]
17 func (h nodeMaxHeap) Less(i, j int) bool {
18 // reversed to make a max-heap
19 return h.lessFunc(&h.nodes[j], &h.nodes[i])
22 func (h *nodeMaxHeap) Push(x interface{}) {
23 h.nodes = append(h.nodes, x.(NodeInfo))
27 func (h *nodeMaxHeap) Pop() interface{} {
29 // return value is never used