In this section the graph edge-colouring and minimum cost
problems will be considered.
An algorithm which colours the graph with no more than
colours
is first given. The problem of minimising the sum of the largest weight
of each colour is then considered and an algorithm will be suggested
that attempts to solve the problem.
Let
be a graph, where
is the set of vertices and
the
set of edges. The degree of a vertex is the number of edges
that are linked to the vertex. The degree of a graph, denoted by
, is the maximum
degree of all vertices of the graph.
Two edges are said to be adjacent if they share the same vertex.
The edge-colouring problem can be defined as follows:
edge-colouring problem assign each edge of the graph
with
a colour, such that no adjacent edges have the same colour.
The chromatic number of a graph,
,
is the least number of colours needed
to edge-colour the graph.
It is easy to see that at least
colours are needed to colour the graph, so
. In fact an interesting theorem in graph
theory, proved by Vizing [15], shows that
Theorem If
is a graph, then
.
Therefore it is always possible to colour the edges of a graph
with no more than
colours. However to decide whether
it is possible to colour the graph with only
colours is
an NP-complete problem [7]. So a practical bound is
colours.
The proof of the Theorem 1 (see, e.g. [4]) is based on
adjusting the colouring of the graph. Let
be the set of
colours. Assume that part of the graph
is coloured with colours from
. Consider adding an uncoloured
edge to the coloured part of the graph.
If there is a common unused colour from the colour set
at both ends of the
edge, then colour the edge with that colour. Otherwise adjust
the colouring of the coloured part of the graph to allow
the new edge to be coloured with no conflict.
The following algorithm, which colours a graph
with no more than
colours, is based on
the proof of the theorem. Here
a path is denoted to be a list of vertices of the form
, where for
,
the pair
constitutes an edge in
and vertices are not repeated, apart
from the case
.
Algorithm COLOUR
In practice there is usually more than one colouring scheme
that edge-colours the graph with no more
than
colours. Let
be the set of all such colouring schemes.
The cost of each colouring scheme, is defined as the sum of the largest weight
of the edges that have the same colour. For example, in Figure 3 (a),
edges (1,6), (2,5) and (3,4) have colour
, with a largest weight of
; edges (1,2) and (6,5) have colour
, with the largest
weight of
; edges (2,3) and (5,4) have colour
, with the largest weight of
, thus
the cost of the colouring scheme given by Figure 3 (a) is
The minimum cost problem can be stated as following
minimum cost problem Among all colouring scheme
,
find one that has the minimum cost.
Although the algorithm COLOUR can give a colouring scheme
with no more than
colours, the colouring scheme
may not be the one with minimum cost.
To illustrate this, Table 3
presents a communication task table given by
partitioning a mesh of 788 elements into 16 subdomains,
using a spectral bisection algorithm. Thus the graph described by the
table has 16 vertices. The maximum degree is
Applying algorithm COLOUR
on the graph of Table 3
results in the scheduling scheme given by Table 4. In this case 5 colours are
used. If one views the table as a communication schedule, then
in the 5-th stage,
processor 10 exchanges messages with processor 13, which needs 10
units of time. Processors
11 and 12 exchange messages which need 2 units of time,
the rest of the processors are idle. A better balancing of the communication
load at each stage will reduce the overall communication costs.
| Processor |
|
||||
| 1 | 9 (2) | 12 (2) | - | - | - |
| 2 | 3 (3) | 10 (1) | 11 (3) | 13 (6) | - |
| 3 | 2 (3) | 10 (4) | 11 (8) | 12 (1) | - |
| 4 | 7 (3) | 14 (5) | 15 (6) | - | - |
| 5 | 9 (2) | 10 (4) | - | - | - |
| 6 | 11 (4) | 12 (5) | 16 (4) | - | - |
| 7 | 4 (3) | 10 (2) | 13 (4) | 14 (6) | - |
| 8 | 15 (6) | 16 (6) | - | - | - |
| 9 | 1 (2) | 5 (2) | - | - | - |
| 10 | 2 (1) | 3 (4) | 5 (4) | 7 (2) | 13 (10) |
| 11 | 2 (3) | 3 (8) | 6 (4) | 12 (2) | - |
| 12 | 1 (2) | 3 (1) | 6 (5) | 11 (2) | 16 (6) |
| 13 | 2 (6) | 7 (4) | 10 (10) | 14 (3) | - |
| 14 | 4 (5) | 7 (6) | 13 (3) | - | - |
| 15 | 4 (6) | 8 (6) | - | - | - |
| 16 | 6 (4) | 8 (6) | 12 (6) | - | - |
| Processor |
|
||||
| 1 | 9 ( 2) | 12 ( 2) | - | - | - |
| 2 | 3 ( 3) | 10 ( 1) | 11 ( 3) | 13 ( 6) | - |
| 3 | 2 ( 3) | 11 ( 8) | 10 ( 4) | 12 ( 1) | - |
| 4 | 7 ( 3) | 14 ( 5) | 15 ( 6) | - | - |
| 5 | 10 ( 4) | 9 ( 2) | - | - | - |
| 6 | 11 ( 4) | 16 ( 4) | 12 ( 5) | - | - |
| 7 | 4 ( 3) | 13 ( 4) | 14 ( 6) | 10 ( 2) | - |
| 8 | 15 ( 6) | - | 16 ( 6) | - | - |
| 9 | 1 ( 2) | 5 ( 2) | - | - | - |
| 10 | 5 ( 4) | 2 ( 1) | 3 ( 4) | 7 ( 2) | 13 ( 10) |
| 11 | 6 ( 4) | 3 ( 8) | 2 ( 3) | - | 12 ( 2) |
| 12 | 16 ( 6) | 1 ( 2) | 6 ( 5) | 3 ( 1) | 11 ( 2) |
| 13 | 14 ( 3) | 7 ( 4) | - | 2 ( 6) | 10 ( 10) |
| 14 | 13 ( 3) | 4 ( 5) | 7 ( 6) | - | - |
| 15 | 8 ( 6) | - | 4 ( 6) | - | - |
| 16 | 12 ( 6) | 6 ( 4) | 8 ( 6) | - | - |
| max. |
6 | 8 | 6 | 6 | 10 |
| comm. cost | 36 | ||||
The following algorithm is proposed in an attempt to solve the minimum cost problem. The idea is to colour as many as possible the edges with large weights using one colour, then repeat the procedure recursively for the remaining edges.
The algorithm, named REDUCE,
starts with a graph edge-colouring with no more than
colours.
Roughly speaking,
a) first the edge
with the largest weight is found and locked,
its colour is
;
b) Then the unlocked edge
with the largest weight is found,
its colour is
. An attempt is then made to colour the two edges
and
with the same colour;
c) If
, then the two edges with largest weights
have indeed the same colour, so lock
.
Otherwise the following
steps are carried out to change the
colour of
into
;
d) If at both ends of the edge
, colour
is unused, then the colour of
can simply be changed to
.
Otherwise the logic used in the algorithm COLOUR can be adapted;
e) The largest path containing the edge
and
coloured alternately with
and
is found.
If it contains locked edges, then lock
;
otherwise the two colours
on the path are exchanged making
having the same colour
as
, and lock
. This process is repeated from b) until all edges are
locked.
The edges with colour
are then removed and the process repeated
on the remaining graph. In this way edges with similar weights are
coloured with the same colour. The detailed algorithm is as follows, where
Algorithm REDUCE
This algorithm is a descent algorithm, in the sense that given a colouring scheme of a graph, applying REDUCE will always produce a colouring scheme with a cost not more than that of the original scheme. This is proved in the following theorem.
Theorem
The algorithm REDUCE applied to an edge-coloured graph results in
a colouring scheme with the cost
not more than that of the original colouring scheme.
Proof
In the algorithm, the only place where the colouring scheme
might be modified is at step 6, when
a path with non-locked edges, coloured with
and
alternately, is found and the two colours
are exchanged. On this path, and in fact among
all unlocked edges,
is the edge with the largest weight.
When the colour
and
are exchanged, the cost for colour
remains equal to the weight of
, because
this is the edge with the largest weight among all the
edges in the current graph. The
cost for colour
will not increase because those edges that changed
their colours from
to
have weights smaller
than that of the edge
, as
is the edge in
with the largest weight. Therefore overall, the cost of the
new colour scheme will not be more than that of the original colouring scheme
In the actual implementation of the algorithm, if the cost is reduced, then the algorithm is restarted on the new coloured graph. This process is repeated until no further reduction is possible.
An example is given by the graph in Figure 3 (a). The process of applying REDUCE to the graph is shown in Figure 4. As a further example, applying the algorithm to the scheduling scheme of Table 4 gives the scheduling scheme of Table 5, the cost is reduced from 36 to 26 - a significant saving.
| Processor |
|
||||
| 1 | 12 ( 2) | - | - | - | 9 ( 2) |
| 2 | 3 ( 3) | 11 ( 3) | 10 ( 1) | 13 ( 6) | - |
| 3 | 2 ( 3) | 12 ( 1) | - | 10 ( 4) | 11 ( 8) |
| 4 | - | - | 7 ( 3) | 14 ( 5) | 15 ( 6) |
| 5 | 10 ( 4) | - | - | 9 ( 2) | - |
| 6 | 16 ( 4) | - | - | 11 ( 4) | 12 ( 5) |
| 7 | 13 ( 4) | 10 ( 2) | 4 ( 3) | - | 14 ( 6) |
| 8 | - | - | - | 15 ( 6) | 16 ( 6) |
| 9 | - | - | - | 5 ( 2) | 1 ( 2) |
| 10 | 5 ( 4) | 7 ( 2) | 2 ( 1) | 3 ( 4) | 13 ( 10) |
| 11 | - | 2 ( 3) | 12 ( 2) | 6 ( 4) | 3 ( 8) |
| 12 | 1 ( 2) | 3 ( 1) | 11 ( 2) | 16 ( 6) | 6 ( 5) |
| 13 | 7 ( 4) | 14 ( 3) | - | 2 ( 6) | 10 ( 10) |
| 14 | - | 13 ( 3) | - | 4 ( 5) | 7 ( 6) |
| 15 | - | - | - | 8 ( 6) | 4 ( 6) |
| 16 | 6 ( 4) | - | - | 12 ( 6) | 8 ( 6) |
| max. |
4 | 3 | 3 | 6 | 10 |
| comm. cost | 26 | ||||
When the algorithm REDUCE terminates, it is not necessary that a global minimum has been found. For that reason we will also test an algorithm which takes the best result for ten runs of the algorithm REDUCE, each run starts with randomly permuted edge and vertex indices. This algorithm is denoted as REDUCE10.
The three algorithms are applied to the communication task graphs resulting from partitioning five meshes of various sizes (given in the column ``mesh'' of the table) using a spectral bisection algorithm. The number of colours and the cost of the colouring scheme generated by the three algorithms are given in Table 6.
| mesh | COLOUR | REDUCE | REDUCE10 | |
| 16 | 771 | 6/44 | 6/34 | 6/30 |
| 16 | 788 | 5/36 | 5/26 | 5/25 |
| 16 | 3564 | 6/74 | 6/59 | 5/56 |
| 16 | 5520 | 5/385 | 4/216 | 4/216 |
| 32 | 353710 | 17/4678 | 17/2042 | 17/2028 |
| 64 | 353710 | 28/4140 | 28/1853 | 28/1823 |
| 128 | 353710 | 36/3433 | 36/1214 | 36/1196 |
| 256 | 353710 | 37/2715 | 37/930 | 37/902 |
From Table 6 it is clear that both the algorithms REDUCE and REDUCE10 improve significantly the cost of the colouring scheme given by the algorithm COLOUR.