greedy-colors ( graph order -- colors )


Vocabulary
compiler.cfg.register-allocation.chordal

Inputs
graphan object
orderan object


Outputs
colorsan object


Definition


:: greedy-colors ( graph order -- colors )
H{ } clone :> colors order [| vertex |
vertex graph at [ colors at ] map
sift :> used 0 :> color!
[ color used member? ] [ color 1 + color! ] while
color vertex colors set-at
] each colors ;