Source File
rank_queue.go
Belonging Package
github.com/pancsta/d2/d2layouts/d2talalayout/internal/hierarchy
package hierarchy// nodeMinHeap is a small, allocation-free priority queue for stable Kahn// traversal. Node indexes already follow entity-ID order.type nodeMinHeap []intfunc ( *nodeMinHeap) ( int) {* = append(*, )for := len(*) - 1; > 0; {:= ( - 1) / 2if (*)[] <= (*)[] {break}(*)[], (*)[] = (*)[], (*)[]=}}func ( *nodeMinHeap) () int {:= *:= [0]:= [len()-1]= [:len()-1]if len() > 0 {[0] =for := 0; ; {:= *2 + 1if >= len() {break}:=:= + 1if < len() && [] < [] {=}if [] <= [] {break}[], [] = [], []=}}* =return}
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |