<s>
The	O
Coffman	B-Operating_System
–	I-Operating_System
Graham	I-Operating_System
algorithm	I-Operating_System
is	O
an	O
algorithm	O
for	O
arranging	O
the	O
elements	O
of	O
a	O
partially	O
ordered	O
set	O
into	O
a	O
sequence	O
of	O
levels	O
.	O
</s>
<s>
It	O
is	O
named	O
after	O
Edward	O
G	O
.	O
Coffman	O
,	O
Jr.	O
and	O
Ronald	O
Graham	O
,	O
who	O
published	O
it	O
in	O
1972	O
for	O
an	O
application	O
in	O
job	B-Algorithm
shop	I-Algorithm
scheduling	I-Algorithm
.	O
</s>
<s>
For	O
a	O
partial	O
ordering	O
given	O
by	O
its	O
transitive	O
reduction	O
(	O
covering	O
relation	O
)	O
,	O
the	O
Coffman	B-Operating_System
–	I-Operating_System
Graham	I-Operating_System
algorithm	I-Operating_System
can	O
be	O
implemented	O
in	O
linear	O
time	O
using	O
the	O
partition	B-Data_Structure
refinement	I-Data_Structure
data	O
structure	O
as	O
a	O
subroutine	O
.	O
</s>
<s>
In	O
the	O
version	O
of	O
the	O
job	B-Algorithm
shop	I-Algorithm
scheduling	I-Algorithm
problem	O
solved	O
by	O
the	O
Coffman	B-Operating_System
–	I-Operating_System
Graham	I-Operating_System
algorithm	I-Operating_System
,	O
one	O
is	O
given	O
a	O
set	O
of	O
jobs	O
,	O
together	O
with	O
a	O
system	O
of	O
precedence	O
constraints	O
requiring	O
that	O
job	O
be	O
completed	O
before	O
job	O
begins	O
.	O
</s>
<s>
The	O
scheduling	O
task	O
is	O
to	O
assign	O
each	O
of	O
these	O
jobs	O
to	O
time	O
slots	O
on	O
a	O
system	O
of	O
identical	O
processors	O
,	O
minimizing	O
the	O
makespan	B-Algorithm
of	O
the	O
assignment	O
(	O
the	O
time	O
from	O
the	O
beginning	O
of	O
the	O
first	O
job	O
until	O
the	O
completion	O
of	O
the	O
final	O
job	O
)	O
.	O
</s>
<s>
Within	O
each	O
group	O
of	O
vertices	O
with	O
the	O
same	O
-coordinate	O
,	O
the	O
vertices	O
are	O
permuted	B-Algorithm
in	O
order	O
to	O
minimize	O
the	O
number	O
of	O
crossings	O
in	O
the	O
resulting	O
drawing	O
,	O
and	O
the	O
vertices	O
are	O
assigned	O
-coordinates	O
consistently	O
with	O
this	O
permutation	B-Algorithm
.	O
</s>
<s>
In	O
this	O
framework	O
,	O
the	O
-coordinate	O
assignment	O
again	O
involves	O
grouping	O
elements	O
of	O
a	O
partially	O
ordered	O
set	O
(	O
the	O
vertices	O
of	O
the	O
graph	O
,	O
with	O
the	O
reachability	O
ordering	O
on	O
the	O
vertex	O
set	O
)	O
into	O
layers	O
(	O
sets	O
of	O
vertices	O
with	O
the	O
same	O
-coordinate	O
)	O
,	O
which	O
is	O
the	O
problem	O
solved	O
by	O
the	O
Coffman	B-Operating_System
–	I-Operating_System
Graham	I-Operating_System
algorithm	I-Operating_System
.	O
</s>
<s>
Although	O
there	O
exist	O
alternative	O
approaches	O
than	O
the	O
Coffman	B-Operating_System
–	I-Operating_System
Graham	I-Operating_System
algorithm	I-Operating_System
to	O
the	O
layering	O
step	O
,	O
these	O
alternatives	O
in	O
general	O
are	O
either	O
not	O
able	O
to	O
incorporate	O
a	O
bound	O
on	O
the	O
maximum	O
width	O
of	O
a	O
level	O
or	O
rely	O
on	O
complex	O
integer	B-Algorithm
programming	I-Algorithm
procedures	O
.	O
</s>
<s>
The	O
Coffman	B-Operating_System
–	I-Operating_System
Graham	I-Operating_System
algorithm	I-Operating_System
performs	O
the	O
following	O
steps	O
.	O
</s>
<s>
In	O
the	O
graph	O
drawing	O
applications	O
of	O
the	O
Coffman	B-Operating_System
–	I-Operating_System
Graham	I-Operating_System
algorithm	I-Operating_System
,	O
the	O
resulting	O
directed	O
acyclic	O
graph	O
may	O
not	O
be	O
the	O
same	O
as	O
the	O
graph	O
being	O
drawn	O
,	O
and	O
in	O
the	O
scheduling	O
applications	O
it	O
may	O
not	O
have	O
an	O
edge	O
for	O
every	O
precedence	O
constraint	O
of	O
the	O
input	O
:	O
in	O
both	O
cases	O
,	O
the	O
transitive	O
reduction	O
removes	O
redundant	O
edges	O
that	O
are	O
not	O
necessary	O
for	O
defining	O
the	O
partial	O
order	O
.	O
</s>
<s>
Construct	O
a	O
topological	B-Algorithm
ordering	I-Algorithm
of	O
in	O
which	O
the	O
vertices	O
are	O
ordered	O
lexicographically	O
by	O
the	O
set	O
of	O
positions	O
of	O
their	O
incoming	O
neighbors	O
.	O
</s>
<s>
Assign	O
the	O
vertices	O
of	O
to	O
levels	O
in	O
the	O
reverse	O
of	O
the	O
topological	B-Algorithm
ordering	I-Algorithm
constructed	O
in	O
the	O
previous	O
step	O
.	O
</s>
<s>
For	O
,	O
the	O
Coffman	B-Operating_System
–	I-Operating_System
Graham	I-Operating_System
algorithm	I-Operating_System
uses	O
a	O
number	O
of	O
levels	O
(	O
or	O
computes	O
a	O
schedule	O
with	O
a	O
makespan	B-Algorithm
)	O
that	O
is	O
within	O
a	O
factor	O
of	O
of	O
optimal	O
.	O
</s>
<s>
When	O
the	O
partial	O
order	O
of	O
precedence	O
constraints	O
is	O
an	O
interval	O
order	O
,	O
or	O
belongs	O
to	O
several	O
related	O
classes	O
of	O
partial	O
orders	O
,	O
the	O
Coffman	B-Operating_System
–	I-Operating_System
Graham	I-Operating_System
algorithm	I-Operating_System
finds	O
a	O
solution	O
with	O
the	O
minimum	O
number	O
of	O
levels	O
regardless	O
of	O
its	O
width	O
bound	O
.	O
</s>
<s>
As	O
well	O
as	O
finding	O
schedules	O
with	O
small	O
makespan	B-Algorithm
,	O
the	O
Coffman	B-Operating_System
–	I-Operating_System
Graham	I-Operating_System
algorithm	I-Operating_System
(	O
modified	O
from	O
the	O
presentation	O
here	O
so	O
that	O
it	O
topologically	O
orders	O
the	O
reverse	O
graph	O
of	O
and	O
places	O
the	O
vertices	O
as	O
early	O
as	O
possible	O
rather	O
than	O
as	O
late	O
as	O
possible	O
)	O
minimizes	O
the	O
total	O
flow	O
time	O
of	O
two-processor	O
schedules	O
,	O
the	O
sum	O
of	O
the	O
completion	O
times	O
of	O
the	O
individual	O
jobs	O
.	O
</s>
<s>
and	O
state	O
the	O
time	O
complexity	O
of	O
the	O
Coffman	B-Operating_System
–	I-Operating_System
Graham	I-Operating_System
algorithm	I-Operating_System
,	O
on	O
an	O
-element	O
partial	O
order	O
,	O
to	O
be	O
.	O
</s>
<s>
shows	O
how	O
to	O
implement	O
the	O
topological	B-Algorithm
ordering	I-Algorithm
stage	O
of	O
the	O
algorithm	O
in	O
linear	O
time	O
,	O
based	O
on	O
the	O
idea	O
of	O
partition	B-Data_Structure
refinement	I-Data_Structure
.	O
</s>
<s>
Sethi	O
also	O
shows	O
how	O
to	O
implement	O
the	O
level	O
assignment	O
stage	O
of	O
the	O
algorithm	O
efficiently	O
by	O
using	O
a	O
disjoint-set	B-Algorithm
data	I-Algorithm
structure	I-Algorithm
.	O
</s>
