graph algorithms edge coloring

89
Graph Algorithms Edge Coloring Graph Algorithms

Upload: others

Post on 12-Feb-2022

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Graph Algorithms Edge Coloring

Graph Algorithms

Edge Coloring

Graph Algorithms

Page 2: Graph Algorithms Edge Coloring

The Input Graph

⋆ A simple and undirected graph G = (V,E) with n vertices

in V , m edges in E, and maximum degree ∆.

Graph Algorithms 1

Page 3: Graph Algorithms Edge Coloring

Matchings

⋆ A matching, M ⊆ E, is a set of edges such that any 2

edges from the set do not intersect.

− ∀(u,v)6=(u′,v′)∈M (u 6= u′, u 6= v′, v 6= u′, v 6= v′).

⋆ A perfect matching, M ⊆ E, is a matching that covers all

the vertices.

− ∀u∈V ∃{(u, v) ∈M}.

Graph Algorithms 2

Page 4: Graph Algorithms Edge Coloring

Example: Matching

Graph Algorithms 3

Page 5: Graph Algorithms Edge Coloring

Example: Maximal Matching

Graph Algorithms 4

Page 6: Graph Algorithms Edge Coloring

Example: Maximum Size Matching

Graph Algorithms 5

Page 7: Graph Algorithms Edge Coloring

Example: Perfect Matching

Graph Algorithms 6

Page 8: Graph Algorithms Edge Coloring

Edge Covering

⋆ An edge covering, EC ⊆ E, is a set of edges such that any

vertex in V belongs to at least one of the edges in EC.

− ∀v∈V ∃e∈EC (e = (u, v)).

Graph Algorithms 7

Page 9: Graph Algorithms Edge Coloring

Example: Edge Covering

Graph Algorithms 8

Page 10: Graph Algorithms Edge Coloring

Example: Minimal Edge Covering

Graph Algorithms 9

Page 11: Graph Algorithms Edge Coloring

Example: Minimum Size Edge Covering

Graph Algorithms 10

Page 12: Graph Algorithms Edge Coloring

Matching and Edge Covering

Definition An isolated vertex is a vertex with no neighbors.

Proposition: EC +M = n for G with no isolated vertices.

Proof outline: Show that EC +M ≥ n and EC +M ≤ n

which imply EC +M = n.

Graph Algorithms 11

Page 13: Graph Algorithms Edge Coloring

EC +M ≥ n

⋆ Construct a matching M ′.

⋆ Consider the edges of EC in any order.

⋆ Add an edge to M ′ if it does not intersect any edge that is

already in M ′.

⋆ The rest of the edges in EC connect a vertex from M ′ to

a vertex that is not in M ′.

⋆ Therefore, the number of edges in EC is the number of

edges in M ′ plus n− 2M ′ additional edges.

Graph Algorithms 12

Page 14: Graph Algorithms Edge Coloring

EC +M ≥ n

EC = M ′ + (n− 2M ′)

= n−M ′

≥ n−M (∗ since M ≥M ′ ∗)

⇒ EC +M ≥ n .

Graph Algorithms 13

Page 15: Graph Algorithms Edge Coloring

EC +M ≤ n

⋆ Construct an edge covering EC ′.

⋆ EC ′ contains all the edges of the maximum matching M .

⋆ For each vertex that is not covered by M , add an edge that

contains it to EC ′.

⋆ Due to the maximality of M , there is no edge that covers

2 vertices that are not covered by M .

⋆ Therefore, the number of edges in EC ′ is the number of

edges in M plus n− 2M additional edges.

Graph Algorithms 14

Page 16: Graph Algorithms Edge Coloring

EC +M ≤ n

EC ′ = M + (n− 2M)

= n−M

⇒ EC ≤ n−M (∗ since EC ′ ≥ EC ∗)

⇒ EC +M ≤ n .

Graph Algorithms 15

Page 17: Graph Algorithms Edge Coloring

Edge Coloring

Definition I:

⋆ A disjoint collection of matchings that cover all the edges

in the graph.

⋆ A partition E = M1 ∪ M2 ∪ · · · ∪Mψ such that Mj is a

matching for all 1 ≤ j ≤ ψ.

Definition II:

⋆ An assignment of colors to the edges such that two

intersecting edges are assigned different colors.

⋆ A function c : E → {1, . . . , ψ} such that if v 6= w and

(u, v), (u,w) ∈ E then c(u, v) 6= c(u,w).

Observation: Both definitions are equivalent.

Graph Algorithms 16

Page 18: Graph Algorithms Edge Coloring

Example: Edge Coloring

Graph Algorithms 17

Page 19: Graph Algorithms Edge Coloring

Example: Edge Coloring with Minimum Number of Colors

Graph Algorithms 18

Page 20: Graph Algorithms Edge Coloring

The Edge Coloring Problem

The optimization problem: Find an edge coloring with

minimum number of colors.

Notation: ψ(G) – the chromatic index of G – the minimum

number of colors required to color all the edges of G.

Hardness: A Hard problem to solve.

⋆ It is NP-Hard to decide if ψ(G) = ∆ or ψ(G) = ∆ + 1

where ∆ is the maximum degree in G.

Graph Algorithms 19

Page 21: Graph Algorithms Edge Coloring

Bounds on the Chromatic Index

⋆ Let ∆ be the maximum degree in G.

⋆ Any edge coloring must use at least ∆ colors.

− ψ(G) ≥ ∆.

⋆ A greedy first-fit algorithm colors the edges of any graph

with at most 2∆ − 1 colors.

− ψ(G) ≤ 2∆ − 1.

⋆ There exists a polynomial time algorithm that colors any

graph with at most ∆ + 1 colors.

− ψ(G) ≤ ∆ + 1.

Graph Algorithms 20

Page 22: Graph Algorithms Edge Coloring

More Bounds on the Chromatic Index

Notation: M(G) – size of the maximum matching in G.

⋆ M(G) ≤ ⌊n/2⌋.

Observation: ψ(G) ≥⌈

mM(G)

.

⋆ A pigeon hole argument: the size of each color-set is at

most M(G).

Corollary: ψ(G) ≥⌈

m⌊n/2⌋

.

Graph Algorithms 21

Page 23: Graph Algorithms Edge Coloring

Vertex Coloring vs. Edge Coloring

⋆ Matching is an easy problem while Independent Set is a

hard problem.

⋆ Edge Coloring is a hard problem while Vertex Coloring is a

very hard problem.

Graph Algorithms 22

Page 24: Graph Algorithms Edge Coloring

Coloring the Edges the Star Graph Sn

⋆ In a star graph ∆ = n− 1.

⋆ Each edge must be colored with a different color

⇒ ψ(Sn) = ∆.

Graph Algorithms 23

Page 25: Graph Algorithms Edge Coloring

Coloring the Edges of the Cycle Cn

⋆ In any cycle ∆ = 2.

⋆ For even n = 2k, edges alternate colors and 2 colors are

enough ⇒ ψ(C2k) = ∆.

⋆ For odd n = 2k + 1, at least 1 edge is colored with a third

color ⇒ ψ(C2k+1) = ∆ + 1.

Graph Algorithms 24

Page 26: Graph Algorithms Edge Coloring

Complete Bipartite Graphs

Bipartite graphs: V = A ∪ B and each edge is incident to

one vertex from A and one vertex from B.

Complete bipartite graphs Ka,b: There are a vertices in A,

b vertices in B, and all possible a · b edges exist.

Graph Algorithms 25

Page 27: Graph Algorithms Edge Coloring

Coloring the Edges of K3,4

Graph Algorithms 26

Page 28: Graph Algorithms Edge Coloring

Coloring the Edges of K3,4

Graph Algorithms 27

Page 29: Graph Algorithms Edge Coloring

Coloring the Edges of K3,4

Graph Algorithms 28

Page 30: Graph Algorithms Edge Coloring

Coloring the Edges of K3,4

Graph Algorithms 29

Page 31: Graph Algorithms Edge Coloring

Coloring the Edges of Complete Bipartite Graphs

⋆ ∆ = max {a, b} in the complete bipartite graph Ka,b.

⋆ Let the vertices be v0, . . . , va−1 ∈ A and u0, . . . , ub−1 ∈ B.

⋆ Assume a ≤ b.

⋆ Color the edges in b = ∆ rounds with the colors 0, . . . ,∆−1.

⋆ In round 0 ≤ i ≤ ∆ − 1, color edges (vj, u(j+i) mod b) with

color i for 0 ≤ j ≤ a.

Graph Algorithms 30

Page 32: Graph Algorithms Edge Coloring

Complete Graphs – Even n

⋆ ψ(Kn) = n− 1 = ∆ for an even n.

− n− 1 disjoint perfect matchings each of size n/2.

− m = (n− 1)(n/2) in a complete graph with n vertices.

Graph Algorithms 31

Page 33: Graph Algorithms Edge Coloring

Complete Graphs – n = 2k power of 2

⋆ If k = 1 color the only edge with 1 = ∆ color.

⋆ If k > 1, partition the vertices into two Kn/2 cliques A and

B each with 2k−1 vertices.

⋆ Color the complete bipartite Kn/2,n/2 implied by the

partition V = A ∪B with n/2 colors.

⋆ Recursively and in parallel, color both cliques A and B with

n/2 − 1 = ∆(Kn/2) colors.

⋆ All together, n− 1 = ∆ colors were used.

Graph Algorithms 32

Page 34: Graph Algorithms Edge Coloring

Coloring the edges of K8

Graph Algorithms 33

Page 35: Graph Algorithms Edge Coloring

Coloring the edges of K8

Graph Algorithms 34

Page 36: Graph Algorithms Edge Coloring

Coloring the edges of K8

Graph Algorithms 35

Page 37: Graph Algorithms Edge Coloring

Coloring the edges of K8

Graph Algorithms 36

Page 38: Graph Algorithms Edge Coloring

Complete Graphs – Odd n

⋆ ψ(Kn) = n = ∆ + 1 for an odd n.

− ψ(Kn) ≤ ψ(Kn+1) = n because n+ 1 is even.

− ψ(Kn) ≥(n(n−1)/2)((n−1)/2) = n because there are

n(n−1)2 edges

in Kn and the size of the maximum matching is n−12 .

Graph Algorithms 37

Page 39: Graph Algorithms Edge Coloring

Coloring the Edges of Odd Complete Graphs

⋆ Arrange the vertices as a regular n-polygon.

⋆ Color the n edges on the perimeter of the polygon using n

colors.

⋆ Color an inside edge with the color of its parallel edge on

the perimeter of the polygon.

Graph Algorithms 38

Page 40: Graph Algorithms Edge Coloring

Coloring the Edges of K7

Graph Algorithms 39

Page 41: Graph Algorithms Edge Coloring

Coloring the Edges of K7

Graph Algorithms 40

Page 42: Graph Algorithms Edge Coloring

Coloring the Edges of K7

Graph Algorithms 41

Page 43: Graph Algorithms Edge Coloring

Coloring the Edges of K7

Graph Algorithms 42

Page 44: Graph Algorithms Edge Coloring

Coloring the Edges of Odd Complete Graphs

Correctness: The coloring is legal:

⋆ Parallel edges do not intersect.

⋆ Each edge is parallel to exactly one perimeter edge.

Number of colors: ψ(K2k+1) = 2k + 1 = ∆ + 1.

Graph Algorithms 43

Page 45: Graph Algorithms Edge Coloring

Coloring the Edges of Even Complete Graphs – Algorithm I

⋆ Let the vertices be 0, . . . , n− 1.

⋆ Color the edges of Kn−1 on the vertices 0, . . . , n− 2 using

the polygon algorithm.

⋆ For 0 ≤ x ≤ n− 2, color the edge (n− 1, x) with the only

color missing at x.

Graph Algorithms 44

Page 46: Graph Algorithms Edge Coloring

Coloring the Edges of K8

Graph Algorithms 45

Page 47: Graph Algorithms Edge Coloring

Coloring the Edges of K8

Graph Algorithms 46

Page 48: Graph Algorithms Edge Coloring

Coloring the Edges of K8

Graph Algorithms 47

Page 49: Graph Algorithms Edge Coloring

Coloring the Edges of Even Complete Graphs – Algorithm I

Correctness: The coloring is legal:

⋆ The coloring of Kn−1 implies a legal coloring for all the

edges except those incident to vertex n− 1.

⋆ Exactly 1 color is missing at a vertex x ∈ {0, . . . , n− 2}.

⋆ This is the color of the perimeter edge opposite to it.

⋆ The n − 1 perimeter edges are colored with different

colors.

Number of colors: ψ(K2k) = 2k − 1 = ∆.

Graph Algorithms 48

Page 50: Graph Algorithms Edge Coloring

Coloring the Edges of Even Complete Graphs – Algorithm II

⋆ Let the vertices be 0, . . . , n− 1.

⋆ In round 0 ≤ x ≤ n− 2, color the following edges with the

color x:− (n− 1, x).

− (((x− 1) mod (n− 1)), ((x+ 1) mod (n− 1))).

− (((x− 2) mod (n− 1)), ((x+ 2) mod (n− 1))).... ...

− (((x−(n2−1)) mod (n−1), ((x+(n2−1)) mod (n−1))).

Correctness and number of colors: The same as Algorithm

I since both algorithms are equivalent!

Graph Algorithms 49

Page 51: Graph Algorithms Edge Coloring

Coloring the Edges of Even Complete Graphs – Algorithm II

7

0

1

2

3

4

5 6

Graph Algorithms 50

Page 52: Graph Algorithms Edge Coloring

Coloring the Edges of Even Complete Graphs – Algorithm III

⋆ Let 0 ≤ i < j ≤ n− 1 be 2 vertices.

⋆ Case j = n− 1:

color the edge (i, j) with the color i.

⋆ Case i+ j is even:

color the edge (i, j) with the color i+j2 .

⋆ Case i+ j is odd and i+ j < n− 1:

color the edge (i, j) with the colori+j+(n−1)

2 .

⋆ Case i+ j is odd and i+ j ≥ n− 1:

color the edge (i, j) with the colori+j−(n−1)

2 .

Correctness and number of edges: The same as Algorithm

I and Algorithm II since all three algorithms are equivalent!

Graph Algorithms 51

Page 53: Graph Algorithms Edge Coloring

Coloring the Edges of Even Complete Graphs – Algorithm III

0

1

2

3

4

5 6

7

Graph Algorithms 52

Page 54: Graph Algorithms Edge Coloring

Greedy First Fit Edge Coloring

Algorithm: Color the edges of G with 2∆ − 1 colors.

⋆ Consider the edges in an arbitrary order.

⋆ Color an edge with the first available color among

{1, 2, . . . , 2∆ − 1}.

Correctness: At the time of coloring, at most 2∆ − 2 colors

are not available. By the pigeon hole argument there exists

an available color.

Graph Algorithms 53

Page 55: Graph Algorithms Edge Coloring

Complexity

⋆ m edges to color.

⋆ O(∆) to find the available color for any edge.

⋆ Overall, O(∆m) complexity.

Graph Algorithms 54

Page 56: Graph Algorithms Edge Coloring

Coloring the Vertices of the Line Graph L(G)

⋆ Coloring the edges of G is equivalent to coloring the vertices

of the line graph L(G) of G.

⋆ If the maximum degree in G is ∆ then the maximum degree

in L(G) is ∆(L(G)) = 2∆ − 2.

⋆ The greedy coloring of the edges of G with 2∆ − 1 colors

is equivalent to the greedy coloring of the vertices of L(G)

with ∆(L(G)) + 1 = 2∆ − 1 colors.

Graph Algorithms 55

Page 57: Graph Algorithms Edge Coloring

Coloring the Vertices of the Line Graph L(G)

Graph Algorithms 56

Page 58: Graph Algorithms Edge Coloring

Subgraphs Definitions

⋆ For colors x and y, let G(x, y) be the subgraph of G

containing all the vertices of G and only the edges whose

colors are x or y.

⋆ For a vertex w, let Gw(x, y) be the connected component

of G(x, y) that contains w.

Graph Algorithms 57

Page 59: Graph Algorithms Edge Coloring

Observation

⋆ G(x, y) is a collection of even size cycles and paths.

Graph Algorithms 58

Page 60: Graph Algorithms Edge Coloring

Exchanging Colors Tool

⋆ Exchanging between the colors x and y in the connected

component Gw(x, y) of G(x, y) results with another legal

coloring.

w w

Graph Algorithms 59

Page 61: Graph Algorithms Edge Coloring

Coloring the edges of Bipartite Graphs with ∆ Colors

⋆ Color the edges with the colors {1, 2, . . . ,∆} following an

arbitrary order. Let (u, v) be the next edge to color.

⋆ At most ∆ − 1 edges containing u or v are colored ⇒ one

color cu is missing at u and one color cv is missing at v.

⋆ If cu = cv then color the edge (u, v) with the color cu = cv.

u( )uc

v( )vc

Graph Algorithms 60

Page 62: Graph Algorithms Edge Coloring

Coloring the Edges of Bipartite Graphs with ∆ Colors

⋆ Assume cu 6= cv.

⋆ Let Gu(cu, cv) be the connected component of the subgraph

of G containing only edges colored with cu and cv.

⋆ Gu(cu, cv) is a path starting at u with a cv colored edge.

u( )uc

v( )vc

Graph Algorithms 61

Page 63: Graph Algorithms Edge Coloring

Coloring the Edges of Bipartite Graphs with ∆ Colors

⋆ The colors in Gu(cu, cv) alternate between cv and cu.

⋆ The first edge in the path starting at u is colored cv ⇒

any edge in the path that starts at the side of u must be

colored with cv.

⋆ v does not belong to Gu(cu, cv) because cv is missing at v.

u( )uc

v( )vc

Graph Algorithms 62

Page 64: Graph Algorithms Edge Coloring

Coloring the Edges of Bipartite Graphs with ∆ Colors

⋆ Exchange between the colors cu and cv in Gu(cu, cv).

⋆ cv is missing at both u and v: color the edge (u, v) with

the color cv.

u( )uc

v( )vc

u( )vc

v( )vc

Graph Algorithms 63

Page 65: Graph Algorithms Edge Coloring

Complexity

⋆ m edges to color.

⋆ O(∆) to find the missing colors at u and v.

⋆ O(n) to change the colors in Gu(cu, cv).

⋆ Overall, O(nm) complexity.

Graph Algorithms 64

Page 66: Graph Algorithms Edge Coloring

Coloring the Edges of Any Graph with ∆ + 1 Colors

⋆ Color the edges with the colors {1, 2, . . . ,∆ + 1} following

an arbitrary order. Let (v0, v1) be the next edge to color.

⋆ At most ∆− 1 edges containing v0 or v1 are colored ⇒ one

color c0 is missing at v0 and one color c1 is missing at v1.

c 0v ( )0

c 1v ( )1

Graph Algorithms 65

Page 67: Graph Algorithms Edge Coloring

Coloring the edges of Any Graph with ∆ + 1 Colors

⋆ If c0 = c1 then color the edge (v0, v1) with the color c0 = c1.

c 0v ( )0

c 1v ( )1

Graph Algorithms 66

Page 68: Graph Algorithms Edge Coloring

Coloring the Edges Any Graph with ∆ + 1 Colors

⋆ Assume c0 6= c1.

⋆ Construct a sequence of distinct colors c0, c1, c2, . . . , cj−1, cjand a sequence of edges (v0, v1), (v0, v2), . . . , (v0, vj).

− Color ci is missing at vi for 0 ≤ i ≤ j.

− ci is the color of the edge (v0, vi+1) for 1 ≤ i ≤ j.

c 0v ( )0

c 1v ( )1

c 2v ( )2

v ( )j jc

v ( )j-1 j-1c

v ( )c3 3

Graph Algorithms 67

Page 69: Graph Algorithms Edge Coloring

Constructing the Sequence

c 0v ( )0

c 1v ( )1

Graph Algorithms 68

Page 70: Graph Algorithms Edge Coloring

Constructing the Sequence

c 0v ( )0

c 1v ( )1

c 2v ( )2

Graph Algorithms 69

Page 71: Graph Algorithms Edge Coloring

Constructing the Sequence

c 0v ( )0

c 1v ( )1

c 2v ( )2

v ( )c3 3

Graph Algorithms 70

Page 72: Graph Algorithms Edge Coloring

Constructing the Sequence

c 0v ( )0

c 1v ( )1

c 2v ( )2

v ( )j jc

v ( )j-1 j-1c

v ( )c3 3

Graph Algorithms 71

Page 73: Graph Algorithms Edge Coloring

Constructing the Sequence

⋆ The edge (v0, v1) and the colors c0, c1 are initially defined.

⋆ Assume the colors c0, c1, . . . , cj−1 and the edges

(v0, v1), (v0, v2), . . . , (v0, vj) are defined:

− ci is missing at vi for 0 ≤ i ≤ j − 1.

− ci is the color of the edge (v0, vi+1) for 1 ≤ i ≤ j − 1.

⋆ Let cj be a color missing at vj.

⋆ If there exists an edge (v0, vj+1) colored with cj, where

vj+1 /∈ {v1, . . . , vj}, then continue constructing the

sequence with the defined cj and vj+1.

Graph Algorithms 72

Page 74: Graph Algorithms Edge Coloring

The Process Terminates

⋆ Since v0 has only ∆ neighbors, the construction process

stops with one of the following cases:

Case I: There is no edge (v0, v) colored with cj.

Case II: For some 2 ≤ k < j: cj = ck−1

⇒ the edge (v0, vk) is colored with cj.

Graph Algorithms 73

Page 75: Graph Algorithms Edge Coloring

Case I

⋆ The color cj is missing at v0.

c 1v ( )1

c 2v ( )2

v ( )j jc

v ( )j-1 j-1c

v ( )c3 3

jc c 0v ( , )0

Graph Algorithms 74

Page 76: Graph Algorithms Edge Coloring

Case I

⋆ Shift colors: Color (v0, vi) with ci for 1 ≤ i ≤ j − 1.

v 1

v 2

v ( )j jc

v j-1

v 3

jc c 0v ( , )0

Graph Algorithms 75

Page 77: Graph Algorithms Edge Coloring

Case I

⋆ cj is missing at both v0 and vj: color (v0, vj) with cj.

v 1

v 2

v ( )j jc

v j-1

v 3

jc c 0v ( , )0

Graph Algorithms 76

Page 78: Graph Algorithms Edge Coloring

Case II

⋆ For some 2 ≤ k < j: cj = ck−1

⇒ (v0, vk) is colored with cj.

c 0v ( )0

c 1v ( )1

c 2v ( )2

v ( )j jc

v ( )j-1 j-1c

c kv ( )k

Graph Algorithms 77

Page 79: Graph Algorithms Edge Coloring

Case II

⋆ Shift colors: color (v0, vi) with ci for 1 ≤ i ≤ k − 1.

⋆ The edge (v0, vk) is not colored.

⋆ cj is missing at both vk and vj.

c 0v ( )0

c 1v ( )1

c 2v ( )2

v ( )j jc

v ( )j-1 j-1c

v ( )k jc

Graph Algorithms 78

Page 80: Graph Algorithms Edge Coloring

Case II

⋆ Consider the sub-graph G(c0, cj) of G containing only the

edges colored with c0 and cj.

⋆ G(c0, cj) is a collection of paths and cycles; v0, vk, vj are

end-vertices of paths in G(c0, cj).

⋆ Not all of the 3 vertices v0, vk, vj are in the same connected

component of G(c0, cj).

Case II.I v0 and vk are in different connected components of

G(c0, cj).

Case II.II v0 and vj are in different connected components

of G(c0, cj).

Graph Algorithms 79

Page 81: Graph Algorithms Edge Coloring

Case II.I

⋆ v0, vk are in different connected components of G(c0, cj).

c 0v ( )0

c 1v ( )1

c 2v ( )2

v ( )j jc

v ( )j-1 j-1c

v ( )k jc

Graph Algorithms 80

Page 82: Graph Algorithms Edge Coloring

Case II.I

⋆ Exchange between c0 and cj in the vk-path in G(c0, cj).

c 0v ( )0

c 1v ( )1

c 2v ( )2

v ( )j jc

v ( )j-1 j-1c

v ( )k 0c

Graph Algorithms 81

Page 83: Graph Algorithms Edge Coloring

Case II.I

⋆ c0 is missing at both v0 and vk: color (v0, vk) with c0.

c 0v ( )0

c 1v ( )1

c 2v ( )2

v ( )j jc

v ( )j-1 j-1c

v ( )k 0c

Graph Algorithms 82

Page 84: Graph Algorithms Edge Coloring

Case II.II

⋆ v0, vj are in different connected components of G(c0, cj).

c 0v ( )0

c 1v ( )1

c 2v ( )2

v ( )j jc

v ( )j-1 j-1c

v ( )k jc

Graph Algorithms 83

Page 85: Graph Algorithms Edge Coloring

Case II.II

⋆ Shift colors: Color (v0, vi) with ci for k ≤ i ≤ j − 1.

⋆ The edge (v0, vj) is not colored.

c 0v ( )0

c 1v ( )1

c 2v ( )2

v ( )j jc

v ( )j-1 j-1c

v ( )k jc

Graph Algorithms 84

Page 86: Graph Algorithms Edge Coloring

Case II.II

⋆ The shift process does not involve c0 and cj ⇒ v0 and vjare still in different connected components of G(c0, cj).

⋆ cj is missing at vj and c0 is missing in v0.

c 0v ( )0

c 1v ( )1

c 2v ( )2

v ( )j jc

v ( )j-1 j-1c

v ( )k jc

Graph Algorithms 85

Page 87: Graph Algorithms Edge Coloring

Case II.II

⋆ Exchange between c0 and cj in the vj-path in G(c0, cj).

v ( ) c 00

c 1v ( )1

c 2v ( )2

v ( )j 0c

v ( )j-1 j-1c

v ( )k jc

Graph Algorithms 86

Page 88: Graph Algorithms Edge Coloring

Case II.II

⋆ c0 is missing at both v0 and vj: color (v0, vj) with c0.

c 0v ( )0

c 1v ( )1

c 2v ( )2

v ( )j 0c

v ( )j-1 j-1c

v ( )k jc

Graph Algorithms 87

Page 89: Graph Algorithms Edge Coloring

Complexity

⋆ m edges to color.

⋆ O(∆2) to find v1, . . . , vj.

⋆ O(n) to exchange colors.

⋆ Overall, O(nm+ ∆2m) complexity.

Graph Algorithms 88