Graph (and Tree) algorithms in Go.
Featuring:
Consider this code unstable. Copy and paste what you need into your own code for stability!
The pathfinding
directory contains algorithms that find the shortest path from
start to goal.
The optimization
directory contains algorithms that find an optimal solution
to a problem that doesn't have a single clear goal.
The adversarial
directory contains algorithms that require an opponent.
The bitset
directory contains functions wrapping common bitwise operations.
for _, copy := range
, use for i := range
or for i := 0; i < len(things); i++
.map
, use arrays/slices: Amortized lookups add up.var pool = make([]Thing, 1_000_000)
, grab items like thing := &pool[cursor]; cursor++
debug.SetGCPercent(-1)
Thing{}
) not the heap (&Thing{}
)