(WS2016/17)
Kapitel 3 More Algorithms
Walter Unger
Lehrstuhl für Informatik 1
11:52 Uhr, den 30. Januar 2017
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3 Inhaltsverzeichnis Walter Unger 30.1.2017 11:52 WS2016/17 Z
Inhalt I
1 Colorings I Cycle Trees
2 Eulerian cycle Introduction Introduction The algorithm
3 Matchings Introduction Algorithm Running times
4 Colorings II Bipartite graphs
∆ +1 Coloring any Graph
5 MIS Introduction MIS and Coloring Small Domination Set Randomized Distributed MIS
6 Coloring III Outerplanar graphs
7 Simulations Simple simulations Simple simulations Simple simulations Advanced simulations
Colorings
Coloring Problem
Given undirected graphG= (V,E)andk∈N. Compute [exists?] Functionc :V 7→ {1,· · ·,k}with:
∀{a,b} ∈E :c(a)6=c(b).
Coloring number (chromatic index) ofG:
χ(G) :=min{{k| ∃c:V 7→ {1,· · ·,k} | ∀{a,b} ∈E:c(a)6=c(b)}.
Coloring problem is NP-complete.
LetG=Cn, i.e.G= ({v0,· · ·,vn−1},{{vi,v(i+1)modn} |06i <n}).
Then we haveχ(Cn)63 andχ(C2·n)62 (χ(C2·n+1) =3).
We do not have a nice order on the nodes:
letπ(i)be a permutation LetG=Cn, i.e.
G = ({v0,· · ·,vn−1},{{vπ(i),vπ((i+1)modn)} |06i<n}).
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3 Inhaltsverzeichnis Walter Unger 30.1.2017 11:52 WS2016/17 Z
Colorings
Coloring Problem
Given undirected graphG= (V,E)andk∈N. Compute [exists?] Functionc :V 7→ {1,· · ·,k}with:
∀{a,b} ∈E :c(a)6=c(b).
Coloring number (chromatic index) ofG:
χ(G) :=min{{k| ∃c:V 7→ {1,· · ·,k} | ∀{a,b} ∈E:c(a)6=c(b)}.
Coloring problem is NP-complete.
LetG=Cn, i.e.G= ({v0,· · ·,vn−1},{{vi,v(i+1)modn} |06i <n}).
Then we haveχ(Cn)63 andχ(C2·n)62 (χ(C2·n+1) =3).
We do not have a nice order on the nodes:
letπ(i)be a permutation LetG=Cn, i.e.
G = ({v0,· · ·,vn−1},{{vπ(i),vπ((i+1)modn)} |06i<n}).
Colorings
Coloring Problem
Given undirected graphG= (V,E)andk∈N. Compute [exists?] Functionc :V 7→ {1,· · ·,k}with:
∀{a,b} ∈E :c(a)6=c(b).
Coloring number (chromatic index) ofG:
χ(G) :=min{{k| ∃c:V 7→ {1,· · ·,k} | ∀{a,b} ∈E:c(a)6=c(b)}.
Coloring problem is NP-complete.
LetG=Cn, i.e.G= ({v0,· · ·,vn−1},{{vi,v(i+1)modn} |06i <n}).
Then we haveχ(Cn)63 andχ(C2·n)62 (χ(C2·n+1) =3).
We do not have a nice order on the nodes:
letπ(i)be a permutation LetG=Cn, i.e.
G = ({v0,· · ·,vn−1},{{vπ(i),vπ((i+1)modn)} |06i<n}).
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3 Inhaltsverzeichnis Walter Unger 30.1.2017 11:52 WS2016/17 Z
Colorings
Coloring Problem
Given undirected graphG= (V,E)andk∈N. Compute [exists?] Functionc :V 7→ {1,· · ·,k}with:
∀{a,b} ∈E :c(a)6=c(b).
Coloring number (chromatic index) ofG:
χ(G) :=min{{k| ∃c:V 7→ {1,· · ·,k} | ∀{a,b} ∈E:c(a)6=c(b)}.
Coloring problem is NP-complete.
LetG=Cn, i.e.G= ({v0,· · ·,vn−1},{{vi,v(i+1)modn} |06i <n}).
Then we haveχ(Cn)63 andχ(C2·n)62 (χ(C2·n+1) =3).
We do not have a nice order on the nodes:
letπ(i)be a permutation LetG=Cn, i.e.
G = ({v0,· · ·,vn−1},{{vπ(i),vπ((i+1)modn)} |06i<n}).
Colorings
Coloring Problem
Given undirected graphG= (V,E)andk∈N. Compute [exists?] Functionc :V 7→ {1,· · ·,k}with:
∀{a,b} ∈E :c(a)6=c(b).
Coloring number (chromatic index) ofG:
χ(G) :=min{{k| ∃c:V 7→ {1,· · ·,k} | ∀{a,b} ∈E:c(a)6=c(b)}.
Coloring problem is NP-complete.
LetG=Cn, i.e.G= ({v0,· · ·,vn−1},{{vi,v(i+1)modn} |06i <n}).
Then we haveχ(Cn)63 andχ(C2·n)62 (χ(C2·n+1) =3).
We do not have a nice order on the nodes:
letπ(i)be a permutation LetG=Cn, i.e.
G = ({v0,· · ·,vn−1},{{vπ(i),vπ((i+1)modn)} |06i<n}).
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3 Inhaltsverzeichnis Walter Unger 30.1.2017 11:52 WS2016/17 Z
Colorings
Coloring Problem
Given undirected graphG= (V,E)andk∈N. Compute [exists?] Functionc :V 7→ {1,· · ·,k}with:
∀{a,b} ∈E :c(a)6=c(b).
Coloring number (chromatic index) ofG:
χ(G) :=min{{k| ∃c:V 7→ {1,· · ·,k} | ∀{a,b} ∈E:c(a)6=c(b)}.
Coloring problem is NP-complete.
LetG=Cn, i.e.G= ({v0,· · ·,vn−1},{{vi,v(i+1)modn} |06i <n}).
Then we haveχ(Cn)63 andχ(C2·n)62 (χ(C2·n+1) =3).
We do not have a nice order on the nodes:
letπ(i)be a permutation LetG=Cn, i.e.
G = ({v0,· · ·,vn−1},{{vπ(i),vπ((i+1)modn)} |06i<n}).
Colorings
Coloring Problem
Given undirected graphG= (V,E)andk∈N. Compute [exists?] Functionc :V 7→ {1,· · ·,k}with:
∀{a,b} ∈E :c(a)6=c(b).
Coloring number (chromatic index) ofG:
χ(G) :=min{{k| ∃c:V 7→ {1,· · ·,k} | ∀{a,b} ∈E:c(a)6=c(b)}.
Coloring problem is NP-complete.
LetG=Cn, i.e.G= ({v0,· · ·,vn−1},{{vi,v(i+1)modn} |06i <n}).
Then we haveχ(Cn)63 andχ(C2·n)62 (χ(C2·n+1) =3).
We do not have a nice order on the nodes:
letπ(i)be a permutation LetG=Cn, i.e.
G = ({v0,· · ·,vn−1},{{vπ(i),vπ((i+1)modn)} |06i<n}).
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3 Inhaltsverzeichnis Walter Unger 30.1.2017 11:52 WS2016/17 Z
Colorings
Coloring Problem
Given undirected graphG= (V,E)andk∈N. Compute [exists?] Functionc :V 7→ {1,· · ·,k}with:
∀{a,b} ∈E :c(a)6=c(b).
Coloring number (chromatic index) ofG:
χ(G) :=min{{k| ∃c:V 7→ {1,· · ·,k} | ∀{a,b} ∈E:c(a)6=c(b)}.
Coloring problem is NP-complete.
LetG=Cn, i.e.G= ({v0,· · ·,vn−1},{{vi,v(i+1)modn} |06i <n}).
Then we haveχ(Cn)63 andχ(C2·n)62 (χ(C2·n+1) =3).
We do not have a nice order on the nodes:
letπ(i)be a permutation LetG=Cn, i.e.
G = ({v0,· · ·,vn−1},{{vπ(i),vπ((i+1)modn)} |06i<n}).
Colorings
Coloring Problem
Given undirected graphG= (V,E)andk∈N. Compute [exists?] Functionc :V 7→ {1,· · ·,k}with:
∀{a,b} ∈E :c(a)6=c(b).
Coloring number (chromatic index) ofG:
χ(G) :=min{{k| ∃c:V 7→ {1,· · ·,k} | ∀{a,b} ∈E:c(a)6=c(b)}.
Coloring problem is NP-complete.
LetG=Cn, i.e.G= ({v0,· · ·,vn−1},{{vi,v(i+1)modn} |06i <n}).
Then we haveχ(Cn)63 andχ(C2·n)62 (χ(C2·n+1) =3).
We do not have a nice order on the nodes:
letπ(i)be a permutation LetG=Cn, i.e.
G = ({v0,· · ·,vn−1},{{vπ(i),vπ((i+1)modn)} |06i<n}).
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3 Inhaltsverzeichnis Walter Unger 30.1.2017 11:52 WS2016/17 Z
Colorings
Coloring Problem
Given undirected graphG= (V,E)andk∈N. Compute [exists?] Functionc :V 7→ {1,· · ·,k}with:
∀{a,b} ∈E :c(a)6=c(b).
Coloring number (chromatic index) ofG:
χ(G) :=min{{k| ∃c:V 7→ {1,· · ·,k} | ∀{a,b} ∈E:c(a)6=c(b)}.
Coloring problem is NP-complete.
LetG=Cn, i.e.G= ({v0,· · ·,vn−1},{{vi,v(i+1)modn} |06i <n}).
Then we haveχ(Cn)63 andχ(C2·n)62 (χ(C2·n+1) =3).
We do not have a nice order on the nodes:
letπ(i)be a permutation LetG=Cn, i.e.
G = ({v0,· · ·,vn−1},{{vπ(i),vπ((i+1)modn)} |06i<n}).
Colorings
Coloring Problem
Given undirected graphG= (V,E)andk∈N. Compute [exists?] Functionc :V 7→ {1,· · ·,k}with:
∀{a,b} ∈E :c(a)6=c(b).
Coloring number (chromatic index) ofG:
χ(G) :=min{{k| ∃c:V 7→ {1,· · ·,k} | ∀{a,b} ∈E:c(a)6=c(b)}.
Coloring problem is NP-complete.
LetG=Cn, i.e.G= ({v0,· · ·,vn−1},{{vi,v(i+1)modn} |06i <n}).
Then we haveχ(Cn)63 andχ(C2·n)62 (χ(C2·n+1) =3).
We do not have a nice order on the nodes:
letπ(i)be a permutation LetG=Cn, i.e.
G = ({v0,· · ·,vn−1},{{vπ(i),vπ((i+1)modn)} |06i<n}).
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:2 Cycle 1/7 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Parallel Coloring Algorithm of (on) a cycle (Idea)
A processorPi works onvπ(i−1)for some permutationπ.
RegisterRi holdsπ(i−1).
RegisterNi holdsπ(i).
In registerCi will be the color ofvRi. InitializeCi withi.
Reduce step by step the number of colors.
We will use the colors{0,1,· · ·,n}.
Parallel Coloring Algorithm of (on) a cycle (Idea)
A processorPi works onvπ(i−1)for some permutationπ.
RegisterRi holdsπ(i−1).
RegisterNi holdsπ(i).
In registerCi will be the color ofvRi. InitializeCi withi.
Reduce step by step the number of colors.
We will use the colors{0,1,· · ·,n}.
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:2 Cycle 3/7 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Parallel Coloring Algorithm of (on) a cycle (Idea)
A processorPi works onvπ(i−1)for some permutationπ.
RegisterRi holdsπ(i−1).
RegisterNi holdsπ(i).
In registerCi will be the color ofvRi. InitializeCi withi.
Reduce step by step the number of colors.
We will use the colors{0,1,· · ·,n}.
Parallel Coloring Algorithm of (on) a cycle (Idea)
A processorPi works onvπ(i−1)for some permutationπ.
RegisterRi holdsπ(i−1).
RegisterNi holdsπ(i).
In registerCi will be the color ofvRi. InitializeCi withi.
Reduce step by step the number of colors.
We will use the colors{0,1,· · ·,n}.
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:2 Cycle 5/7 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Parallel Coloring Algorithm of (on) a cycle (Idea)
A processorPi works onvπ(i−1)for some permutationπ.
RegisterRi holdsπ(i−1).
RegisterNi holdsπ(i).
In registerCi will be the color ofvRi. InitializeCi withi.
Reduce step by step the number of colors.
We will use the colors{0,1,· · ·,n}.
Parallel Coloring Algorithm of (on) a cycle (Idea)
A processorPi works onvπ(i−1)for some permutationπ.
RegisterRi holdsπ(i−1).
RegisterNi holdsπ(i).
In registerCi will be the color ofvRi. InitializeCi withi.
Reduce step by step the number of colors.
We will use the colors{0,1,· · ·,n}.
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:2 Cycle 7/7 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Parallel Coloring Algorithm of (on) a cycle (Idea)
A processorPi works onvπ(i−1)for some permutationπ.
RegisterRi holdsπ(i−1).
RegisterNi holdsπ(i).
In registerCi will be the color ofvRi. InitializeCi withi.
Reduce step by step the number of colors.
We will use the colors{0,1,· · ·,n}.
Parallel Coloring Algorithm of (on) a cycle (Idea)
Programm: color-cycle
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(i)→Ni
c=i c→Ci
repeatdlog∗(n)e+2times CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:3 Cycle 2/5 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Parallel Coloring Algorithm of (on) a cycle (Idea)
Programm: color-cycle
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(i)→Ni
c=i c→Ci
repeatdlog∗(n)e+2times CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
Parallel Coloring Algorithm of (on) a cycle (Idea)
Programm: color-cycle
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(i)→Ni
c=i c→Ci
repeatdlog∗(n)e+2times CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:3 Cycle 4/5 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Parallel Coloring Algorithm of (on) a cycle (Idea)
Programm: color-cycle
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(i)→Ni
c=i c→Ci
repeatdlog∗(n)e+2times CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
Parallel Coloring Algorithm of (on) a cycle (Idea)
Programm: color-cycle
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(i)→Ni
c=i c→Ci
repeatdlog∗(n)e+2times CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:4 Cycle 1/5 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Parallel Coloring Algorithm of (on) a cycle (Idea)
At the start we are usingncolors.
Within each color-reduction will the coloring stay correct.
Within each color reduction will thc coloring number be reduced fromx to log(x) +O(1).
Afterdlog∗(n)ereductions steps will be the coloring numbers65.
A second reduction of colors will follow now:
Parallel Coloring Algorithm of (on) a cycle (Idea)
At the start we are usingncolors.
Within each color-reduction will the coloring stay correct.
Within each color reduction will thc coloring number be reduced fromx to log(x) +O(1).
Afterdlog∗(n)ereductions steps will be the coloring numbers65.
A second reduction of colors will follow now:
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:4 Cycle 3/5 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Parallel Coloring Algorithm of (on) a cycle (Idea)
At the start we are usingncolors.
Within each color-reduction will the coloring stay correct.
Within each color reduction will thc coloring number be reduced fromx to log(x) +O(1).
Afterdlog∗(n)ereductions steps will be the coloring numbers65.
A second reduction of colors will follow now:
Parallel Coloring Algorithm of (on) a cycle (Idea)
At the start we are usingncolors.
Within each color-reduction will the coloring stay correct.
Within each color reduction will thc coloring number be reduced fromx to log(x) +O(1).
Afterdlog∗(n)ereductions steps will be the coloring numbers65.
A second reduction of colors will follow now:
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:4 Cycle 5/5 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Parallel Coloring Algorithm of (on) a cycle (Idea)
At the start we are usingncolors.
Within each color-reduction will the coloring stay correct.
Within each color reduction will thc coloring number be reduced fromx to log(x) +O(1).
Afterdlog∗(n)ereductions steps will be the coloring numbers65.
A second reduction of colors will follow now:
Last Steps
The rows holdc and the columns holdc0. The entries in the table hold the newc.
000 001 010 011 100 101 110 111
0 000 1 001 2 010 3 011 4 100 5 101 6 110 7 111
We only have the colors 000,001,010,011,100,101 (65).
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:5 Cycle 2/4 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Last Steps
The rows holdc and the columns holdc0. The entries in the table hold the newc.
000 001 010 011 100 101 110 111
0 000 000 010 000 100 000 010 000
1 001 001 001 010 001 100 001 010
2 010 011 000 000 011 000 100 000
3 011 001 011 001 001 011 001 100
4 100 101 000 010 000 000 010 000
5 101 001 101 001 010 001 001 010
6 110 011 000 101 000 011 000 000
7 111 001 011 001 101 001 011 001
We only have the colors 000,001,010,011,100,101 (65).
Last Steps
The rows holdc and the columns holdc0. The entries in the table hold the newc.
000 001 010 011 100 101 110 111
0 000 0 2 0 4 0 2 0
1 001 1 1 2 1 4 1 2
2 010 3 0 0 3 0 4 0
3 011 1 3 1 1 3 1 4
4 100 5 0 2 0 0 2 0
5 101 1 5 1 2 1 1 2
6 110 3 0 5 0 3 0 0
7 111 1 3 1 5 1 3 1
We only have the colors 000,001,010,011,100,101 (65).
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:5 Cycle 4/4 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Last Steps
The rows holdc and the columns holdc0. The entries in the table hold the newc.
000 001 010 011 100 101 110 111
0 000 0 2 0 4 0 2 0
1 001 1 1 2 1 4 1 2
2 010 3 0 0 3 0 4 0
3 011 1 3 1 1 3 1 4
4 100 5 0 2 0 0 2 0
5 101 1 5 1 2 1 1 2
6 110 3 0 5 0 3 0 0
7 111 1 3 1 5 1 3 1
We only have the colors 000,001,010,011,100,101 (65).
Parallel Coloring Algorithm of (on) a cycle (Idea)
Programm: color-cycle
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(i)→Ni
c=i c→Ci
repeatdlog∗(n)e+2times CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
forr:=5downto3do:
ifc=r then CNi →c0 c0→Ci
CNi →c00
c:=min({0,1,2} \ {c0,c00}) c→Ci
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:6 Cycle 2/8 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Parallel Coloring Algorithm of (on) a cycle (Idea)
Programm: color-cycle
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(i)→Ni
c=i c→Ci
repeatdlog∗(n)e+2times CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
forr:=5downto3do:
ifc=r then CNi →c0 c0→Ci
CNi →c00
c:=min({0,1,2} \ {c0,c00}) c→Ci
Parallel Coloring Algorithm of (on) a cycle (Idea)
Programm: color-cycle
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(i)→Ni
c=i c→Ci
repeatdlog∗(n)e+2times CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
forr:=5downto3do:
ifc=r then CNi →c0 c0→Ci
CNi →c00
c:=min({0,1,2} \ {c0,c00}) c→Ci
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:6 Cycle 4/8 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Parallel Coloring Algorithm of (on) a cycle (Idea)
Programm: color-cycle
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(i)→Ni
c=i c→Ci
repeatdlog∗(n)e+2times CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
forr:=5downto3do:
ifc=r then CNi →c0 c0→Ci
CNi →c00
c:=min({0,1,2} \ {c0,c00}) c→Ci
Parallel Coloring Algorithm of (on) a cycle (Idea)
Programm: color-cycle
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(i)→Ni
c=i c→Ci
repeatdlog∗(n)e+2times CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
forr:=5downto3do:
ifc=r then CNi →c0 c0→Ci
CNi →c00
c:=min({0,1,2} \ {c0,c00}) c→Ci
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:6 Cycle 6/8 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Parallel Coloring Algorithm of (on) a cycle (Idea)
Programm: color-cycle
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(i)→Ni
c=i c→Ci
repeatdlog∗(n)e+2times CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
forr:=5downto3do:
ifc=r then CNi →c0 c0→Ci
CNi →c00
c:=min({0,1,2} \ {c0,c00}) c→Ci
Parallel Coloring Algorithm of (on) a cycle (Idea)
Programm: color-cycle
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(i)→Ni
c=i c→Ci
repeatdlog∗(n)e+2times CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
forr:=5downto3do:
ifc=r then CNi →c0 c0→Ci
CNi →c00
c:=min({0,1,2} \ {c0,c00}) c→Ci
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:6 Cycle 8/8 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Parallel Coloring Algorithm of (on) a cycle (Idea)
Programm: color-cycle
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(i)→Ni
c=i c→Ci
repeatdlog∗(n)e+2times CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
forr:=5downto3do:
ifc=r then CNi →c0 c0→Ci
CNi →c00
c:=min({0,1,2} \ {c0,c00}) c→Ci
Coloring a Cycle
Theorem:
A cycle withnnodes could be colored withnprocessors in timeO(log∗n)with at most 3 colors.
Proof: see above.
Theorem:
A cycle ofnprocessors may color itself in timeO(log∗n)with at most 3 colors.
Proof: see above.
Theorem:
A cycle ofnprocessors needs at leastΩ(log∗n)time to color itself with at most 3 colors.
Proof: see V4.
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:7 Cycle 2/4 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Coloring a Cycle
Theorem:
A cycle withnnodes could be colored withnprocessors in timeO(log∗n)with at most 3 colors.
Proof: see above.
Theorem:
A cycle ofnprocessors may color itself in timeO(log∗n)with at most 3 colors.
Proof: see above.
Theorem:
A cycle ofnprocessors needs at leastΩ(log∗n)time to color itself with at most 3 colors.
Proof: see V4.
Coloring a Cycle
Theorem:
A cycle withnnodes could be colored withnprocessors in timeO(log∗n)with at most 3 colors.
Proof: see above.
Theorem:
A cycle ofnprocessors may color itself in timeO(log∗n)with at most 3 colors.
Proof: see above.
Theorem:
A cycle ofnprocessors needs at leastΩ(log∗n)time to color itself with at most 3 colors.
Proof: see V4.
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:7 Cycle 4/4 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Coloring a Cycle
Theorem:
A cycle withnnodes could be colored withnprocessors in timeO(log∗n)with at most 3 colors.
Proof: see above.
Theorem:
A cycle ofnprocessors may color itself in timeO(log∗n)with at most 3 colors.
Proof: see above.
Theorem:
A cycle ofnprocessors needs at leastΩ(log∗n)time to color itself with at most 3 colors.
Proof: see V4.
Coloring a Tree
A processorPi works onvπ(i−1)for some permutationπ.
RegisterRi holdsπ(i−1).
RegisterNi holdsπ(j−1)wherejis the father ofi. The father of the rootr isr.
In registerCi will be the color ofvRi. InitializeCi withi.
Reduce step by step the number of colors.
We will use the colors{0,1,· · ·,n}.
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:8 Trees 2/8 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Coloring a Tree
A processorPi works onvπ(i−1)for some permutationπ.
RegisterRi holdsπ(i−1).
RegisterNi holdsπ(j−1)wherejis the father ofi. The father of the rootr isr.
In registerCi will be the color ofvRi. InitializeCi withi.
Reduce step by step the number of colors.
We will use the colors{0,1,· · ·,n}.
Coloring a Tree
A processorPi works onvπ(i−1)for some permutationπ.
RegisterRi holdsπ(i−1).
RegisterNi holdsπ(j−1)wherejis the father ofi. The father of the rootr isr.
In registerCi will be the color ofvRi. InitializeCi withi.
Reduce step by step the number of colors.
We will use the colors{0,1,· · ·,n}.
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:8 Trees 4/8 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Coloring a Tree
A processorPi works onvπ(i−1)for some permutationπ.
RegisterRi holdsπ(i−1).
RegisterNi holdsπ(j−1)wherejis the father ofi. The father of the rootr isr.
In registerCi will be the color ofvRi. InitializeCi withi.
Reduce step by step the number of colors.
We will use the colors{0,1,· · ·,n}.
Coloring a Tree
A processorPi works onvπ(i−1)for some permutationπ.
RegisterRi holdsπ(i−1).
RegisterNi holdsπ(j−1)wherejis the father ofi. The father of the rootr isr.
In registerCi will be the color ofvRi. InitializeCi withi.
Reduce step by step the number of colors.
We will use the colors{0,1,· · ·,n}.
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:8 Trees 6/8 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Coloring a Tree
A processorPi works onvπ(i−1)for some permutationπ.
RegisterRi holdsπ(i−1).
RegisterNi holdsπ(j−1)wherejis the father ofi. The father of the rootr isr.
In registerCi will be the color ofvRi. InitializeCi withi.
Reduce step by step the number of colors.
We will use the colors{0,1,· · ·,n}.
Coloring a Tree
A processorPi works onvπ(i−1)for some permutationπ.
RegisterRi holdsπ(i−1).
RegisterNi holdsπ(j−1)wherejis the father ofi. The father of the rootr isr.
In registerCi will be the color ofvRi. InitializeCi withi.
Reduce step by step the number of colors.
We will use the colors{0,1,· · ·,n}.
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:8 Trees 8/8 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Coloring a Tree
A processorPi works onvπ(i−1)for some permutationπ.
RegisterRi holdsπ(i−1).
RegisterNi holdsπ(j−1)wherejis the father ofi. The father of the rootr isr.
In registerCi will be the color ofvRi. InitializeCi withi.
Reduce step by step the number of colors.
We will use the colors{0,1,· · ·,n}.
Parallel Coloring Algorithm of (on) a tree (Idea)
Programm: color-cycle
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(i)→Ni
c=i c→Ci
repeatdlog∗(n)e+2times CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:9 Trees 2/5 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Parallel Coloring Algorithm of (on) a tree (Idea)
Programm: color-cycle
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(i)→Ni
c=i c→Ci
repeatdlog∗(n)e+2times CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
Parallel Coloring Algorithm of (on) a tree (Idea)
Programm: color-cycle
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(i)→Ni
c=i c→Ci
repeatdlog∗(n)e+2times CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:9 Trees 4/5 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Parallel Coloring Algorithm of (on) a tree (Idea)
Programm: color-cycle
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(i)→Ni
c=i c→Ci
repeatdlog∗(n)e+2times CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
Parallel Coloring Algorithm of (on) a tree (Idea)
Programm: color-cycle
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(i)→Ni
c=i c→Ci
repeatdlog∗(n)e+2times CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:10 Trees 1/5 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Parallel Coloring Algorithm of (on) a tree (Idea)
At the start we are usingncolors.
Within each color-reduction will the coloring stay correct.
Within each color reduction will the coloring number be reduced fromx to log(x) +O(1).
Afterdlog∗(n)ereductions steps will be the coloring numbers65.
A second reduction of colors will follow now:
Parallel Coloring Algorithm of (on) a tree (Idea)
At the start we are usingncolors.
Within each color-reduction will the coloring stay correct.
Within each color reduction will the coloring number be reduced fromx to log(x) +O(1).
Afterdlog∗(n)ereductions steps will be the coloring numbers65.
A second reduction of colors will follow now:
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:10 Trees 3/5 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Parallel Coloring Algorithm of (on) a tree (Idea)
At the start we are usingncolors.
Within each color-reduction will the coloring stay correct.
Within each color reduction will the coloring number be reduced fromx to log(x) +O(1).
Afterdlog∗(n)ereductions steps will be the coloring numbers65.
A second reduction of colors will follow now:
Parallel Coloring Algorithm of (on) a tree (Idea)
At the start we are usingncolors.
Within each color-reduction will the coloring stay correct.
Within each color reduction will the coloring number be reduced fromx to log(x) +O(1).
Afterdlog∗(n)ereductions steps will be the coloring numbers65.
A second reduction of colors will follow now:
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:10 Trees 5/5 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Parallel Coloring Algorithm of (on) a tree (Idea)
At the start we are usingncolors.
Within each color-reduction will the coloring stay correct.
Within each color reduction will the coloring number be reduced fromx to log(x) +O(1).
Afterdlog∗(n)ereductions steps will be the coloring numbers65.
A second reduction of colors will follow now:
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:11 Trees 1/2 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Parallel Coloring Algorithm of (on) a tree (Idea)
Programm: color-tree
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(i)→Ni
c=i andc→Ci
repeatdlog∗(n)e+2times CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
forr:=5downto3do:
ifc=r then CNi →c0 c0→Ci
CNi →c00
c:=min({0,1,2} \ {c0,c00}) c→Ci
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:11 Trees 2/2 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Parallel Coloring Algorithm of (on) a tree (Idea)
Programm: color-tree
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(i)→Ni
c=i andc→Ci
repeatdlog∗(n)e+2times, ifRi 6=Ni
CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
forr:=5downto3do:
ifc=r then CNi →c0 c0→Ci
CNi →c00
c:=min({0,1,2} \ {c0,c00}) c→Ci
Parallel Coloring Algorithm of (on) a tree (Idea)
Programm: color-cycle
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(j−1)→Ni withj is father ofi c=i andc→Ci
repeatdlog∗(n)e+2times CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
ifRi =Ni thenc=min({0,1} \Ri elsec=CNi
c→Ci
forr:=5downto3do:
ifc=r then CNi →c0 c0→Ci
CNi →c00
c:=min({0,1,2} \ {c0,c00}) c→Ci
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:12 Trees 2/4 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Parallel Coloring Algorithm of (on) a tree (Idea)
Programm: color-cycle
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(j−1)→Ni withj is father ofi c=i andc→Ci
repeatdlog∗(n)e+2times CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
ifRi =Ni thenc=min({0,1} \Ri elsec=CNi
c→Ci
forr:=5downto3do:
ifc=r then CNi →c0 c0→Ci
CNi →c00
c:=min({0,1,2} \ {c0,c00}) c→Ci
Parallel Coloring Algorithm of (on) a tree (Idea)
Programm: color-cycle
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(j−1)→Ni withj is father ofi c=i andc→Ci
repeatdlog∗(n)e+2times CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
ifRi =Ni thenc=min({0,1} \Ri elsec=CNi
c→Ci
forr:=5downto3do:
ifc=r then CNi →c0 c0→Ci
CNi →c00
c:=min({0,1,2} \ {c0,c00}) c→Ci
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:12 Trees 4/4 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Parallel Coloring Algorithm of (on) a tree (Idea)
Programm: color-cycle
for allPi+1 where 06i <ndo in parallel π(i−1)→Ri
π(j−1)→Ni withj is father ofi c=i andc→Ci
repeatdlog∗(n)e+2times CNi →c0
minimalk with:((ck)%2)6= ((c0k)%2).
c=2·k+ ((ck)%2).
c→Ci
ifRi =Ni thenc=min({0,1} \Ri elsec=CNi
c→Ci
forr:=5downto3do:
ifc=r then CNi →c0 c0→Ci
CNi →c00
c:=min({0,1,2} \ {c0,c00}) c→Ci
Coloring a Tree
Theorem:
A tree withnnodes could be colored with nprocessors in timeO(log∗n)with at most 3 colors.
Proof: see above.
Theorem:
A tree ofnprocessors may color itself in timeO(log∗n)with at most 3 colors.
Proof: see above.
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:13 Trees 2/2 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Coloring a Tree
Theorem:
A tree withnnodes could be colored with nprocessors in timeO(log∗n)with at most 3 colors.
Proof: see above.
Theorem:
A tree ofnprocessors may color itself in timeO(log∗n)with at most 3 colors.
Proof: see above.
Eulerian cycle
Definition:
A graphG= (V,E)is called Eulerian, iff there exists a cycle which visits each edge precisely once.
Theorem
A non-directed graphG= (V,E)is Eulerian G is connected and
each node ofG has even degree.
Theorem
A directed graphG= (V,E)is Eulerian G is strong connected and
each node as as many incoming edges as outgoing ones.
Problem: Compute Eulerian cycle on Eulerian graphs.
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:14 Introduction 2/4 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Eulerian cycle
Definition:
A graphG= (V,E)is called Eulerian, iff there exists a cycle which visits each edge precisely once.
Theorem
A non-directed graphG= (V,E)is Eulerian G is connected and
each node ofG has even degree.
Theorem
A directed graphG= (V,E)is Eulerian G is strong connected and
each node as as many incoming edges as outgoing ones.
Problem: Compute Eulerian cycle on Eulerian graphs.
Eulerian cycle
Definition:
A graphG= (V,E)is called Eulerian, iff there exists a cycle which visits each edge precisely once.
Theorem
A non-directed graphG= (V,E)is Eulerian G is connected and
each node ofG has even degree.
Theorem
A directed graphG= (V,E)is Eulerian G is strong connected and
each node as as many incoming edges as outgoing ones.
Problem: Compute Eulerian cycle on Eulerian graphs.
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:14 Introduction 4/4 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Eulerian cycle
Definition:
A graphG= (V,E)is called Eulerian, iff there exists a cycle which visits each edge precisely once.
Theorem
A non-directed graphG= (V,E)is Eulerian G is connected and
each node ofG has even degree.
Theorem
A directed graphG= (V,E)is Eulerian G is strong connected and
each node as as many incoming edges as outgoing ones.
Problem: Compute Eulerian cycle on Eulerian graphs.
Idea
Non Parallel:
Start with a free edge and follow free/unused edges till a cycle is closed.
Repeat till all edges are is some cycle.
Join pairs of cycles into a single one.
Repeat till just one cycle remains.
IfG is non-directed, then make a directed version ofG. Compute a cover of cycles.
Compute an additional cycle which meets each cycle precisely once.
Uses these to compute a cycle forG
Delete some edges to get a Eulerian cycle forG.
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:15 Introduction 2/10 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Idea
Non Parallel:
Start with a free edge and follow free/unused edges till a cycle is closed.
Repeat till all edges are is some cycle.
Join pairs of cycles into a single one.
Repeat till just one cycle remains.
IfG is non-directed, then make a directed version ofG. Compute a cover of cycles.
Compute an additional cycle which meets each cycle precisely once.
Uses these to compute a cycle forG
Delete some edges to get a Eulerian cycle forG.
Idea
Non Parallel:
Start with a free edge and follow free/unused edges till a cycle is closed.
Repeat till all edges are is some cycle.
Join pairs of cycles into a single one.
Repeat till just one cycle remains.
IfG is non-directed, then make a directed version ofG. Compute a cover of cycles.
Compute an additional cycle which meets each cycle precisely once.
Uses these to compute a cycle forG
Delete some edges to get a Eulerian cycle forG.
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:15 Introduction 4/10 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Idea
Non Parallel:
Start with a free edge and follow free/unused edges till a cycle is closed.
Repeat till all edges are is some cycle.
Join pairs of cycles into a single one.
Repeat till just one cycle remains.
IfG is non-directed, then make a directed version ofG. Compute a cover of cycles.
Compute an additional cycle which meets each cycle precisely once.
Uses these to compute a cycle forG
Delete some edges to get a Eulerian cycle forG.
Idea
Non Parallel:
Start with a free edge and follow free/unused edges till a cycle is closed.
Repeat till all edges are is some cycle.
Join pairs of cycles into a single one.
Repeat till just one cycle remains.
IfG is non-directed, then make a directed version ofG. Compute a cover of cycles.
Compute an additional cycle which meets each cycle precisely once.
Uses these to compute a cycle forG
Delete some edges to get a Eulerian cycle forG.
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:15 Introduction 6/10 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Idea
Non Parallel:
Start with a free edge and follow free/unused edges till a cycle is closed.
Repeat till all edges are is some cycle.
Join pairs of cycles into a single one.
Repeat till just one cycle remains.
IfG is non-directed, then make a directed version ofG. Compute a cover of cycles.
Compute an additional cycle which meets each cycle precisely once.
Uses these to compute a cycle forG
Delete some edges to get a Eulerian cycle forG.
Idea
Non Parallel:
Start with a free edge and follow free/unused edges till a cycle is closed.
Repeat till all edges are is some cycle.
Join pairs of cycles into a single one.
Repeat till just one cycle remains.
IfG is non-directed, then make a directed version ofG. Compute a cover of cycles.
Compute an additional cycle which meets each cycle precisely once.
Uses these to compute a cycle forG
Delete some edges to get a Eulerian cycle forG.
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:15 Introduction 8/10 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Idea
Non Parallel:
Start with a free edge and follow free/unused edges till a cycle is closed.
Repeat till all edges are is some cycle.
Join pairs of cycles into a single one.
Repeat till just one cycle remains.
IfG is non-directed, then make a directed version ofG. Compute a cover of cycles.
Compute an additional cycle which meets each cycle precisely once.
Uses these to compute a cycle forG
Delete some edges to get a Eulerian cycle forG.
Idea
Non Parallel:
Start with a free edge and follow free/unused edges till a cycle is closed.
Repeat till all edges are is some cycle.
Join pairs of cycles into a single one.
Repeat till just one cycle remains.
IfG is non-directed, then make a directed version ofG. Compute a cover of cycles.
Compute an additional cycle which meets each cycle precisely once.
Uses these to compute a cycle forG
Delete some edges to get a Eulerian cycle forG.
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:15 Introduction 10/10 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Idea
Non Parallel:
Start with a free edge and follow free/unused edges till a cycle is closed.
Repeat till all edges are is some cycle.
Join pairs of cycles into a single one.
Repeat till just one cycle remains.
IfG is non-directed, then make a directed version ofG. Compute a cover of cycles.
Compute an additional cycle which meets each cycle precisely once.
Uses these to compute a cycle forG
Delete some edges to get a Eulerian cycle forG.
Change a non-directed Graph into a directed one
G containmnon-directed edges.
Substitute each non-directed edge with two directed ones:
{i,j}becomes(i,j)and(j,i).
Define a successor for each edge:
The neighbors ofv are:v0,v1,· · ·,vd−1. Then define for alli:
Succ((vi,v)) := (v,v(i+1)modd)und Succ((v(i+1)modd,v)) := (v,vi).
Each directed edge is in precisely one cycle (defined bySucc).
For each cycleC exists one cycleC0, which consists the reverse edges.
We will now delete one of the two cyclesC orC0.
Colorings I Eulerian cycle Matchings Colorings II MIS Coloring III S.
3:16 Introduction 2/8 Walter Unger 30.1.2017 11:52 WS2016/17 Z
Change a non-directed Graph into a directed one
G containmnon-directed edges.
Substitute each non-directed edge with two directed ones:
{i,j}becomes(i,j)and(j,i).
Define a successor for each edge:
The neighbors ofv are:v0,v1,· · ·,vd−1. Then define for alli:
Succ((vi,v)) := (v,v(i+1)modd)und Succ((v(i+1)modd,v)) := (v,vi).
Each directed edge is in precisely one cycle (defined bySucc).
For each cycleC exists one cycleC0, which consists the reverse edges.
We will now delete one of the two cyclesC orC0.
Change a non-directed Graph into a directed one
G containmnon-directed edges.
Substitute each non-directed edge with two directed ones:
{i,j}becomes(i,j)and(j,i).
Define a successor for each edge:
The neighbors ofv are:v0,v1,· · ·,vd−1. Then define for alli:
Succ((vi,v)) := (v,v(i+1)modd)und Succ((v(i+1)modd,v)) := (v,vi).
Each directed edge is in precisely one cycle (defined bySucc).
For each cycleC exists one cycleC0, which consists the reverse edges.
We will now delete one of the two cyclesC orC0.