exchange-affinity-colors ( graph order affinities colors -- )


Vocabulary
compiler.cfg.register-allocation.chordal

Inputs
graphan object
orderan object
affinitiesan object
colorsan object


Outputs
None

Definition


:: exchange-affinity-colors
( graph order affinities colors -- )
0 :> passes! t :> changed!
[ changed passes 2 < and ] [
f changed! passes 1 + passes! order [| vertex |
vertex affinities at [| partner |
vertex colors at
:> first-color partner colors at
:> second-color second-color [
first-color second-color =
not partner vertex graph at member? not and
] [ f ] if [
vertex first-color second-color graph colors
two-color-component
:> component partner component key?
[ ] [
component first-color second-color
affinities colors exchange-benefit 0 >
~quotation~ when
] if
] when
] each
] each
] while ;