maximum-cardinality-order ( graph -- order )


Vocabulary
compiler.cfg.register-allocation.chordal

Inputs
graphan object


Outputs
orderan object


Definition


:: maximum-cardinality-order ( graph -- order )
H{ } clone :> weights
H{ } clone :> selected <max-heap> :> pending
V{ } clone :> order graph keys
[| vertex | vertex 0 vertex neg 2array pending heap-push ]
each
[ order length graph assoc-size < ] [
pending heap-pop drop :> best best selected key?
[ ] [
best selected conjoin best order push best graph at
[| neighbor |
neighbor selected key?
[ ] [
neighbor weights inc-at
neighbor neighbor weights at
neighbor neg 2array pending heap-push
] if
] each
] if
] while order ;