• Keine Ergebnisse gefunden

Theory of Parallel and Distributed Systems (WS2016/17)

N/A
N/A
Protected

Academic year: 2022

Aktie "Theory of Parallel and Distributed Systems (WS2016/17)"

Copied!
88
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Theory of Parallel and Distributed Systems (WS2016/17)

Kapitel 3 More Algorithms

Walter Unger

Lehrstuhl für Informatik 1

12:01 Uhr, den 30. Januar 2017

(2)

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 Advanced simulations

(3)

3 Inhaltsverzeichnis Walter Unger 30.1.2017 12:01 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}).

(4)

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}.

(5)

3:3 Cycle Walter Unger 30.1.2017 12:01 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

(6)

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:

(7)

3:5 Cycle Walter Unger 30.1.2017 12:01 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).

(8)

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

(9)

3:7 Cycle Walter Unger 30.1.2017 12:01 WS2016/17 Z

Coloring a Cycle

Theorem:

A cycle withnnodes could be colored withnprocessors in timeO(logn)with at most 3 colors.

Proof: see above.

Theorem:

A cycle ofnprocessors may color itself in timeO(logn)with at most 3 colors.

Proof: see above.

Theorem:

A cycle ofnprocessors needs at leastΩ(logn)time to color itself with at most 3 colors.

Proof: see V4.

(10)

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}.

(11)

3:9 Trees Walter Unger 30.1.2017 12:01 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

(12)

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:

(13)

3:11 Trees Walter Unger 30.1.2017 12:01 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

(14)

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

(15)

3:13 Trees Walter Unger 30.1.2017 12:01 WS2016/17 Z

Coloring a Tree

Theorem:

A tree withnnodes could be colored with nprocessors in timeO(logn)with at most 3 colors.

Proof: see above.

Theorem:

A tree ofnprocessors may color itself in timeO(logn)with at most 3 colors.

Proof: see above.

(16)

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.

(17)

3:15 Introduction Walter Unger 30.1.2017 12:01 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.

(18)

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.

(19)

3:17 Introduction Walter Unger 30.1.2017 12:01 WS2016/17 Z

Generating a directed Graph

Identify the generated cycles:

Let min((i,j),(k,l)) :=

(i,j) ifi 6k∨i =k∧j<l

(k,l) otherwise .

For each edgee defineEdge0(e) =e;

For all edgese repeat logmtimes:

Edge0(e) =min(Edge0(e),Edge0(Succ(e))) Succ(e) =Succ(Succ(e)).

For each edge(i,j): if min((i,j),(j,i))6= (i,j)then letEdge0(e) =0.

Thus we have selected for each non-directed edge a directed one (resp. a direction).

Possible withmin timeO(logm).

We consider in the following on directed graphs.

(20)

Step 1

LetG= (V,E)be a directed graph.

Sort the edges into an arrayEdge.

using the order:(i,j)<(k,l)⇔j<l∨(j=l∧i<k).

Sort the edges into an arraySucc.

using the order:(i,j)<(k,l)⇔i<k∨(i =k∧j<l).

We have already defined the cycles:

Successor of edgee=Edge(i)is the edgeSucc(i).

We also store inP(i)the position ofSucc(i)in Edge.

I.e.Edge(P(i)) =Succ(i).

This information could be updated during the sorting ofSucc. This could be done in timeO(logm)usingO(m)processors.

(21)

3:19 The algorithm Walter Unger 30.1.2017 12:01 WS2016/17 Z

Step 2

Situation: We have a directed graph covered by cycles.

Problem: Compute for each edgee the cycles wheree belongs to.

Solution: compute for each cycle the minimal edge ((i,j)<(k,l)⇔i <k∨(i=k∧j<l)).

Algorithm:

Programm:

for allPi where 16i 6mdo in parallel CycleRep(i) :=Succ(i)

fori:=1todlogmedo:

CycleRep(i) :=min(CycleRep(i),CycleRep(P(i))) P(i) :=P(P(i))

We use again the doubling technique.

Possible in timeO(logm)usingO(m)Processors.

(22)

Step 2 (Continued)

Situation: the cycles of the coverage are identified byCycleRep.

Problem: join the cycle into a single one.

Solution: Identify the nodes of the cycle.

C ={CycleRep(i)|16i6m}. (NoteC is a edge set) G0=V∪C

E0={(u,v)|u∈V,v∈C :v is identified in the cycle byu}

Computing ofE0: Programm:

for allPi where 16i 6mdo in parallel (u,v) =Edge(i)

Edge0(2·i) = (u,CycleRep(i)) Edge0(2·i+1) = (v,CycleRep(i))

(23)

3:21 The algorithm Walter Unger 30.1.2017 12:01 WS2016/17 Z

Step 2 (Continued)

Situation: Cover of cycles and graphG0defined.

Problem: there are multiple edges.

Solution: sort them out.

SortEdge0. Programm:

for allPi where 16i 6mdo in parallel ifEdge0(i) =Edge0(i+1)thenEdge(i) =∞ SortEdge0.

Consider only the first|E0|elements ofEdge0.

Problem: nodeucould appear several times in a cyclev. As before we may compute a single representative.

Let these edge be(i,u) =Cert(u,v).

May be done in timeO(logm)usingO(m)processors.

(24)

Step 3

Situation: Covering of the cycles and graphG0computed.

Problem: Compute cycle inG0.

Solution: compute spanning teeT for the bipartite GraphG0.

To compute spanning tree we needO(log2m)time withO(m/log2m) Processors.

Then we substitute each edge inT with two directed edges.

The new graphT0 is Eulerian.

The Eulerian cycle is easy to find:

To do so, compute for each node of the tree the order of edges.

Could be don in timeO(logm)usingO(m)processors.

(25)

3:23 The algorithm Walter Unger 30.1.2017 12:01 WS2016/17 Z

Step 4

Situation: We have a cover of cycles forG andT0. Problem: Find cycleLinG0.

Solution: Combine the cycles usingCert(u,v).

Lwill also contain the Eulerian cycle inG.

For each cyclev inG Cert(u,v)gives us an edge, at which we may exchange betweenv and the cycle inT0.

These points of change will be used to construct a single cycleL.

TimeO(1)usingO(m)Processors.

(26)

Step 5

Situation: we have a cycle forG andT0. Problem: find cycle inG.

Solution: delete edges fromT0. Programm:

for allPi where 16i 6mdo in parallel

ifSucc(i)∈T0 thenSucc(i) :=Succ(Succ(i)) ifSucc(i)∈T0 thenSucc(i) :=Succ(Succ(i)) Uses timeO(1)withO(m)processors.

Total time is:O(log2m)usingO(m)processors.

Also possible:O(log2m)time usingO(m/log2m)processors.

(27)

3:25 Introduction Walter Unger 30.1.2017 12:01 WS2016/17 Z

Definition

Definition

LetG= (V,E)be a non-directed graph.

M⊂E is called a matching, iff∀e,e0∈M:e∩e0=∅.

M is called maximal matching, iff6 ∃e∈E :M∪ {e}is a matching.

M is called maximum matching, iff for all matchingsM0 we have

|M0|6|M|.

Sequential:O(mlogm)for maximal matching.

Idea: Choose any free edge and delete all incident edges.

Sequential:O(m3)for maximum matching.

Idea: enlarging alternating pathes.

(28)

Idea

Let∆(G)be the maximal degree ofG.

Enlarge the matching step by step by several edges.

There will beO(log3/2n)phases.

i-te phaseFi hasGi as input and will outputMi. G1=G and final result:∪Mi.

Within each phaseFi we will call the procedureDegreeSplit (1+log(∆(G)))-times.

Within each step within a phase we will half the node degree.

We denote withG(i,j)the graph considered in thej-th Step of thei-th phase.

We will describe the procedureDegreeSplit.

Letkbe the smallest number with 2k6∆(G)62k+1. We will call all nodesv withδ(v)>2k active.

(29)

3:27 Algorithm Walter Unger 30.1.2017 12:01 WS2016/17 Z

Step 1

Compute all active nodes ofG(i,j)

Determine the degree in timeO(log∆(G(i,j)))withO(m) processors.

Determine the maximum degree in timeO(logn)withO(n) processors.

Then the active nodes are known in timeO(1)usingO(n) processors.

Total running time:O(logn)usingO(m)processors.

(30)

Step 2

Compute the graphG(i,j)as follows:

Compute all nodes that are incident to active nodes.

Determine the new node degree.

If there are nodes with odd degree connect them to a new nodev.

Total running time:O(logn)usingO(m)processors.

G(i,j)might not be connected.

Each component ofG(i,j)contains an Eulerian cycle.

Note that each nodev has even degree.

(31)

3:29 Algorithm Walter Unger 30.1.2017 12:01 WS2016/17 Z

Step 3

Compute an Eulerian cycle on each component ofG(i,j).

This needs timeO(log2n)withO(m+n)processors.

Note that the additionalnprocessors result from the additional edges.

Label the edges from the Eulerian cycle alternating with 0 and 1.

For the component with the additional nodev start withv using label 0.

For all other components start at an arbitrary node with label 1.

Running time:O(logn)withO(m+n)processors.

Use Parallel Prefix to compute the labels.

(32)

Step 4

Delete all edges with label 0.

If the remaining graphG∗∗(i,j)is not a matching then G(i,j+1) =G∗∗(i,j)\ {v}.

If the remaining graphG∗∗(i,j)is a matching thenMi =E(G∗∗(i,j)).

Running time:O(1)withO(m+n)processors.

Running time of the procedureDegreeSplit:O(log2n)withO(m+n) processors.

It remains to show: After at most 1+log(∆(G(i,j)))stepsDegreeSplit computes a matching.

It remains to show: After at mostO(log3/2n)phases the matching is optimal.

(33)

3:31 Running times Walter Unger 30.1.2017 12:01 WS2016/17 Z

Inner loop

Lemma:

LetG be the input ofDegreeSplit, thenDegreeSplit will compute a matching after 1+log(∆(G))iterations.

Proof:

Letkbe the smallest number with 2k6∆(G)62k+1+1.

KetG1be the result of an iteration.

Letv be active inG. It holds:

2kG(v).

G(v)/2c6δG1(v)6bδG(v)/2c+1.

2k−16δG1(v)62k+1.

Thenv stays active inG1.

Hence the degree is halved in every step.

There exists ak06ksuch thatGk0 has a degree of 3.

After two more iterations the degree is at most one.

So a matching is found.

(34)

Outer loop

Lemma:

A logarithmic number of phases is enough to compute a maximum matching.

Proof:

LetAi be the nodes that are active in phaseFi. ThenAi is a vertex cover ofGi.

(C⊂V is a vertex cover if∀e∈E :e∩C6=∅) We show the following;

Half of the nodes in a vertex coverAi can be made incident to edges fromMi.

This means it holds:|Ai/Gi+1|6|Ai|/2.

withAi/Gi+1 the nodes ofAi inGi+1

There are vertex coversCi:|Ci+1|62· |Ci|/3.

(35)

3:33 Running times Walter Unger 30.1.2017 12:01 WS2016/17 Z

Outer loop (Proof)

LetGk= (V,Ek)be the graph in the third to last loop ofDegreeSplit. W.l.o.g.Gkis connected with degree63.

DegreeSplit can w.l.o.g. remove the smallest set of edges.

Hence it holds|Mi|>|Ek|/4.

(36)

Outer loop (Proof)

|Mi|>|Ek|/4

If|Ek|>|Ai|thenMi contains at least|Ai|/4 edges.

Both end points of an edge fromAi belong toAi and at least half of them are incident toMi.

If|Ek|<|Ai|thenGk is a tree.

We remove edges fromGk that have a leaf as one of its end points.

Furthermore the incident edges are removed.

(37)

3:35 Running times Walter Unger 30.1.2017 12:01 WS2016/17 Z

Outer loop (Proof)

|Mi|>|Ek|/4

Because∆(Gk)63 at most 2 treesT1andT2 remain (withn1+n2

nodes).

Then((n1−1) + (n2−1))/4 edges are added toMi. ThenMi contains|Ai|/2 nodes.

Then it holds:|Ai/Gi+1|6|Ai|/2.

(38)

Outer loop (Proof)

|Mi|>|Ek|/4

|Ai/Gi+1|6|Ai|/2

We show using induction thatGi contains a vertex coverCi with

|Ci|6(2/3)i−1|V|.

We will show that|Ci+1|62|Ci|/3.

Basis:i =1: ChooseC1=V. Case 1:|Ai|64|Ci|/3.

In phasei half of the nodes are removed fromAi. Ai/Gi+1is a vertex cover fromGi+1.

|Ai|/26(4|Ci|/3)/2=2|Ci|/3.

Case 2:|Ai|>4|Ci|/3.

Half of the nodes fromAi are removed.

These have end points inMi. Ci is a vertex cover ofGi.

Then every edge has at least one end point inCi. At least 1/4 of the edges inAi are contained inCi. Ci/Gi+1 is a vertex cover ofGi+1.

|Ci/Gi+1|6|Ci| − |Ai|/46|Ci| −(4|Ci|/3)/4=2|Ci|/3.

(39)

3:37 Running times Walter Unger 30.1.2017 12:01 WS2016/17 Z

Summary

|Mi|>|Ek|/4

|Ai/Gi+1|6|Ai|/2

Theorem:

A maximal vertex cover can be computed in timeO(log4n)usingO(n+m) processors.

Proof:

Outer loop:O(logn) Inner loop:O(logn)

Running time ofDegreeSplit:O(log2n).

(40)

Edge coloring of bipartite graphs

Bipartite graphs

A graphG= (A,B,E)withE ⊂A×B is called bipartite graph.

directed line graph

LetG= (V,E)be a directed graph, thenG2= (E,F)with F={((a,b),(b,c))|(a,b),(b,c)∈E}is the line graph ofG. undirected line graph

LetG= (V,E)be an undirected graph, thenG2= (E,F)with F={{{a,b},{b,c}} | {a,b},{b,c} ∈E}is the line graph ofG. Edge coloring

LetG= (V,E)be an undirected graph andk∈N. Compute [Exists?] ak-coloring ofG2.

(41)

3:39 Bipartite graphs Walter Unger 30.1.2017 12:01 WS2016/17 Z

Introduction

LetG= (V,E)be an undirected graph.

It is NP-complete to find a∆(G)edge coloring.

There is always a∆(G) +1 edge coloring.

A bipartite graphG is∆(G)edge colorable.

Or: A bipartite graphG can be covered with∆(G)matchings.

Here: Parallel edge coloring of a bipartite graph.

1.Step:∆(G) =2k for somek∈N.

(42)

Method for ∆(G ) = 2

k

Idea: Cover the edges ofG with cycles and paths.

Color edges alternating with 0 and 1.

This computes a partition ofG inG0 andG1with

∆(G0) = ∆(G1) =2k−1.

All steps can be done in timeO(logn)withO(m)processors.

Continue recursively.

Total running time:O(log2n)withO(m)processors.

(43)

3:41 Bipartite graphs Walter Unger 30.1.2017 12:01 WS2016/17 Z

Example

@

@

@

@

@

@

@

@

@

@

B

B B

B B

B B

B B

B B

B B

B A

A A

A A

A A

A AA J

J J

J J

J J L

L L

L L

L L

L L

L LL

L

L L

L L

L L

L L

L LL L

L L

L L

L L

L L

L LL

A A

A A

A A

A A

AA A

A A

A A

A A

A AA

J J

J J

J J

J J

J J

J J

J J J

J J

J J

J J J

J J

J J

J J

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

H

HH HH H

HH HH B

B B

B B

B B

B B

B B

B B

B v

v v v v v v v

v v v v v v v v

@

@

@

@

@

@

@

@

@

@

B

B B

B B

B B

B B

B B

B B

B A

A A

A A

A A

A AA J

J J

J J

J J L

L L

L L

L L

L L

L LL

L

L L

L L

L L

L L

L LL L

L L

L L

L L

L L

L LL

v v v v v v v v

v v v v v v v v

A A

A A

A A

A A

AA A

A A

A A

A A

A AA

J J

J J

J J

J J

J J

J J

J J J

J J

J J

J J J

J J

J J

J J

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

HH

HHH HH

H HH B

B B

B B

B B

B B

B B

B B

B v

v v v v v v v

v v v v v v v v

(44)

Example

@

@

@

@

B

B B

B BB A

A AA J

J J L

L L

LL

L

L L

LL L

L L

LL

A

A AA A

A AA

J

J J J

J J J

J J J

J J

@

@

@

@

@

@

@

@

HH HH B

B B

B BB rr rr rr rr

rr rr rr rr

@

@

@

@

B

B B

B BB A

A AA J

J J L

L L

LL

L

L L

LL L

L L

LL rr rr rr rr

rr rr rr rr

A

A AA A

A AA

J

J J J

J J J

J J J

J J

@

@

@

@

@

@

@

@

HH HH B

B B

B BB rr rr rr rr

rr rr rr rr

@

@

@

@

B

B B

B BB A

A AA rr rr rr rr

rr rr rr rr

J J

J L

L L

LL

L

L L

LL L

L L

LL rr rr rr rr

rr rr rr rr

A

A AA A

A AA

J

J J J

J J J

J J J

J J

rr rr rr rr

rr rr rr rr

@

@

@

@

@

@

@

@

HH HH B

B B

B BB rr rr rr rr

rr rr rr rr

@

@

@

@

rr rr rr rr

rr rr rr rr

B

B B

B BB A

A AA rr rr rr rr

rr rr rr rr

J J

J L

L L

LL rr rr rr rr

rr rr rr rr

L

L L

LL L

L L

LL rr rr rr rr

rr rr rr rr

A

A AA A

A AA rr rr rr rr

rr rr rr rr

J

J J J

J J J

J J J

J J

rr rr rr rr

rr rr rr rr

@

@

@

@

@

@

@

@ rr rr rr rr

rr rr rr rr

HH HH B

B B

B BB rr rr rr rr

rr rr rr rr

(45)

3:43 Bipartite graphs Walter Unger 30.1.2017 12:01 WS2016/17 Z

Example

@

@

@

@

@

@

@

@

@

@

@

@

B

B B

B B

B B

B B

B B

B B

B B

B BB A

A A

A A

A A

A A

A AA J

J J

J J

J J

J J L

L L

L L

L L

L L

L L

L L

LL

L

L L

L L

L L

L L

L L

L L

LL L

L L

L L

L L

L L

L L

L L

LL

A A

A A

A A

A A

A A

AA A

A A

A A

A A

A A

A AA

J J

J J

J J

J J

J J

J J

J J

J J

J J J

J J

J J

J J

J J J

J J

J J

J J

J J

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

H

HH HH

H H

HH HH

H B

B B

B B

B B

B B

B B

B B

B B

B BB x

x x x x x x x

x x x x x x x x

(46)

Method for ∆(G ) < 2

k

(Idea)

Color as many edges as possible in the sub graphG0with∆(G0) =2k0. Allow double coloring of edges,

i.e.(i,j)is coloredαati andβatj.

Within each step it holds:

There are correctly colored edges and double colored edges.

The set of colorsSis chosen such that the number of double colored edges is as big as possible,

These edges become colored correctly.

This happens in the extended sub graph with∆(G0) =2k0.

(47)

3:45 Bipartite graphs Walter Unger 30.1.2017 12:01 WS2016/17 Z

Method for ∆(G ) < 2

k

(Idea)

Letk0: 2k0 <∆(G)<2k0+1,C=∅andU=E.

PartitionF={0,1,2,· · ·,∆(G)−1}into four sets of almost the same sizeS1,S2,S3,S4.

Repeat until all edges are colored correctly:

Choose double coloring of the edges fromU.

Chosei,jwith: As many edges as possible fromUare colored with onlySi∪Sj.

LetU0be those edges.

It holds:|U0|>|U|/6 andU062k0.

LetH be those edges that only use colors fromSi∪Sj. LetG0= (V,H), extendG0 such that∆(G0) =2k0. ColorG0using the method from above.

SetC =C∪H, these are the correctly colored edges.

Total running time:O(log3n)withO(m)processors.

(48)

Example (1. round)

PP PP PP PP P PP

PP PP

PPP

aa aa aa aa aa

aa aa

aa

H HH HH H H

HH HH

H

!!!!!!!!

!!

!!

!!

!

!

Q Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

A A A A

A A

PP PP PP PP P PP

PP PP

PPP

@

@

@

@

@

@

Q Q Q QQ Q

Q Q

QQ

H HH HH H H

HH HH

H

@

@

@

@

@

@

!!!!!!!!

!!

!!

!!

!

!

!!!!!!!!

!!

!!

!!

!

!

aa aa aa aa aa

aa aa

aa

aa aa aa aa aa

aa aa

aa

H HH HH H H

HH HH

H

x x x x x x x x

x x x x x x x x

@

@

@

@

@

@

aa aa aa a a aa

aa aa

aa

aa aa aa a a aa

aa aa

aa

@

@

@

@

@

@

PP PP PP PP P PP

PP PP

PPP

HH HH HH HH

HH HH

Q Q Q QQ Q

Q Q

QQ

aa aa aa a a aa

aa aa

aa

!!!!!!!!

!!

!!

!!

!!

!!!!!!!!

!!

!!

!!

!!

HH HH HH HH

HH HH

HH HH HH HH

HH HH

!!!!!!!!

!!

!!

!!

!!

Q Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

A A A A

A A

PP PP PP PP P PP

PP PP

PPP

x x x x x x x x

x x x x x x x x

@

@

@

@

@

@

aa aa aa aa aa

aa aa

aa

aa aa aa aa aa

aa aa

aa

@

@

@

@

@

@

PP PP PP PP P PP

PP PP

PPP

H HH HH H H

HH HH

H

Q Q Q QQ Q

Q Q

QQ

aa aa aa aa aa

aa aa

aa

!!!!!!!!

!!

!!

!!

!

!

!!!!!!!!

!!

!!

!!

!

!

H HH HH H H

HH HH

H

x x x x x x x x

x x x x x x x x

(49)

3:47 Bipartite graphs Walter Unger 30.1.2017 12:01 WS2016/17 Z

Example (2. round)

@

@

@

@

@

@

Q Q Q QQ Q

Q Q

QQ

H HH HH H H

HH HH

H

@

@

@

@

@

@

PP PP PP PP P PP

PP PP

PPP

aa aa aa aa aa

aa aa

aa

H HH HH H H

HH HH

H

!!!!!!!!

!!

!!

!!

!

!

Q Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

A A A A

A A

PP PP PP PP P PP

PP PP

PPP

!!!!!!!!

!!

!!

!!

!

!

!!!!!!!!

!!

!!

!!

!

!

aa aa aa aa aa

aa aa

aa

aa aa aa aa aa

aa aa

aa

H HH HH H H

HH HH

H

x x x x x x x x

x x x x x x x x

@

@

@

@

@

@

Q Q Q QQ Q

Q Q

QQ

HH HH HH HH

HH HH

@

@

@

@

@

@

!!!!!!!!

!!

!!

!!

!!

!!!!!!!!

!!

!!

!!

!!

aa aa aa a a aa

aa aa

aa

aa aa aa a a aa

aa aa

aa

@

@

@

@

@

@

HH HH HH HH

HH HH

PP PP PP PP P PP

PP PP

PPP

aa aa aa a a aa

aa aa

aa

HH HH HH HH

HH HH

!!!!!!!!

!!

!!

!!

!!

Q Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

A A A A

A A

PP PP PP PP P PP

PP PP

PPP

x x x x x x x x

x x x x x x x x

!!!!!!!!

!!

!!

!!

!

!

!!!!!!!!

!!

!!

!!

!

!

aa aa aa aa aa

aa aa

aa

aa aa aa aa aa

aa aa

aa

@

@

@

@

@

@

H HH HH H H

HH HH

H PP PP PP PP P PP

PP PP

PPP

aa aa aa aa aa

aa aa

aa

H HH HH H H

HH HH

H

!!!!!!!!

!!

!!

!!

!

!

Q Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

@

@

@

@

@

@

@

@

@

@

@

@

x x x x x x x x

x x x x x x x x

(50)

Example (2. round)

@

@

@

@

@

@

Q Q Q QQ Q

Q Q

QQ

H HH HH H H

HH HH

H

@

@

@

@

@

@

@

@

@

@

@

@

A A A A

A A

PP PP PP PP P PP

PP PP

PPP

!!!!!!!!

!!

!!

!!

!

!

@

@

@

@

@

@

@

@

@

@

@

@

PP PP PP PP P PP

PP PP

PPP

Q Q Q QQ Q

Q Q

QQ

!!!!!!!!

!!

!!

!!

!

!

Q

Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

H HH HH H H

HH HH

H

@

@

@

@

@

@

aa aa aa aa aa

aa aa

aa

aa aa aa aa aa

aa aa

aa

aa aa aa aa aa

aa aa

aa

!!!!!!!!

!!

!!

!!

!

!

H HH HH H H

HH HH

H

Q Q Q QQ Q

Q Q

QQ

x x x x x x x x

x x x x x x x x

@

@

@

@

@

@

Q Q Q QQ Q

Q Q

QQ

HH HH HH HH

HH HH

@

@

@

@

@

@

!!!!!!!!

!!

!!

!!

!!

!!!!!!!!

!!

!!

!!

!!

aa aa aa a a aa

aa aa

aa

aa aa aa a a aa

aa aa

aa

@

@

@

@

@

@

HH HH HH HH

HH HH

PP PP PP PP P PP

PP PP

PPP

aa aa aa a a aa

aa aa

aa

HH HH HH HH

HH HH

!!!!!!!!

!!

!!

!!

!!

Q Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

A A A A

A A

PP PP PP PP P PP

PP PP

PPP

x x x x x x x x

x x x x x x x x

!!!!!!!!

!!

!!

!!

!

!

!!!!!!!!

!!

!!

!!

!

!

aa aa aa aa aa

aa aa

aa

aa aa aa aa aa

aa aa

aa

@

@

@

@

@

@

H HH HH H H

HH HH

H PP PP PP PP P PP

PP PP

PPP

aa aa aa aa aa

aa aa

aa

H HH HH H H

HH HH

H

!!!!!!!!

!!

!!

!!

!

!

Q Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

@

@

@

@

@

@

@

@

@

@

@

@

x x x x x x x x

x x x x x x x x

(51)

3:49 Bipartite graphs Walter Unger 30.1.2017 12:01 WS2016/17 Z

Example (3. round)

@

@

@

@

@

@

Q Q Q QQ Q

Q Q

QQ

H HH HH H H

HH HH

H

@

@

@

@

@

@

!!!!!!!!

!!

!!

!!

!

!

@

@

@

@

@

@

@

@

@

@

@

@

PP PP PP PP P PP

PP PP

PPP

Q Q Q QQ Q

Q Q

QQ

!!!!!!!!

!!

!!

!!

!

!

Q

Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

H HH HH H H

HH HH

H

@

@

@

@

@

@

aa aa aa aa aa

aa aa

aa

aa aa aa aa aa

aa aa

aa

aa aa aa aa aa

aa aa

aa

!!!!!!!!

!!

!!

!!

!

!

H HH HH H H

HH HH

H

Q Q Q QQ Q

Q Q

QQ

@

@

@

@

@

@

A A A A

A A

PP PP PP PP P PP

PP PP

PPP

x x x x x x x x

x x x x x x x x

@

@

@

@

@

@

Q Q Q QQ Q

Q Q

QQ

HH HH HH HH

HH HH

@

@

@

@

@

@

!!!!!!!!

!!

!!

!!

!!

@

@

@

@

@

@

@

@

@

@

@

@

PP PP PP PP P PP

PP PP

PPP

Q Q Q QQ Q

Q Q

QQ

!!!!!!!!

!!

!!

!!

!!

Q Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

HH HH HH HH

HH HH

@

@

@

@

@

@

aa aa aa a a aa

aa aa

aa

aa aa aa a a aa

aa aa

aa

aa aa aa a a aa

aa aa

aa

!!!!!!!!

!!

!!

!!

!!

HH HH HH HH

HH HH

Q Q Q QQ Q

Q Q

QQ

@

@

@

@

@

@

A A A A

A A

PP PP PP PP P PP

PP PP

PPP

x x x x x x x x

x x x x x x x x

aa aa aa aa aa

aa aa

aa

aa aa aa aa aa

aa aa

aa

aa aa aa aa aa

aa aa

aa

!!!!!!!!

!!

!!

!!

!

!

H HH HH H H

HH HH

H

Q Q Q QQ Q

Q Q

QQ

@

@

@

@

@

@

A A A A

A A

PP PP PP PP P PP

PP PP

PPP

x x x x x x x x

x x x x x x x x

(52)

Example (3. round)

@

@

@

@

@

@

Q Q Q QQ Q

Q Q

QQ

H HH HH H H

HH HH

H

@

@

@

@

@

@

!!!!!!!!

!!

!!

!!

!

!

@

@

@

@

@

@

@

@

@

@

@

@

PP PP PP PP P PP

PP PP

PPP

Q Q Q QQ Q

Q Q

QQ

!!!!!!!!

!!

!!

!!

!

!

Q

Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

H HH HH H H

HH HH

H

@

@

@

@

@

@

aa aa aa aa aa

aa aa

aa

aa aa aa aa aa

aa aa

aa

aa aa aa aa aa

aa aa

aa

!!!!!!!!

!!

!!

!!

!

!

H HH HH H H

HH HH

H

Q Q Q QQ Q

Q Q

QQ

@

@

@

@

@

@ A A A A

A A

PP PP PP PP P PP

PP PP

PPP

x x x x x x x x

x x x x x x x x

@

@

@

@

@

@

Q Q Q QQ Q

Q Q

QQ

HH HH HH HH

HH HH

@

@

@

@

@

@

!!!!!!!!

!!

!!

!!

!!

@

@

@

@

@

@

@

@

@

@

@

@

PP PP PP PP P PP

PP PP

PPP

Q Q Q QQ Q

Q Q

QQ

!!!!!!!!

!!

!!

!!

!!

Q Q Q QQ Q

Q Q

QQ

Q Q Q QQ Q

Q Q

QQ

HH HH HH HH

HH HH

@

@

@

@

@

@

aa aa aa a a aa

aa aa

aa

aa aa aa a a aa

aa aa

aa

aa aa aa a a aa

aa aa

aa

!!!!!!!!

!!

!!

!!

!!

HH HH HH HH

HH HH

Q Q Q QQ Q

Q Q

QQ

@

@

@

@

@

@

A A A A

A A

PP PP PP PP P PP

PP PP

PPP

x x x x x x x x

x x x x x x x x

aa aa aa aa aa

aa aa

aa

aa aa aa aa aa

aa aa

aa

aa aa aa aa aa

aa aa

aa

!!!!!!!!

!!

!!

!!

!

!

H HH HH H H

HH HH

H

Q Q Q QQ Q

Q Q

QQ

@

@

@

@

@

@

A A A A

A A

PP PP PP PP P PP

PP PP

PPP

x x x x x x x x

x x x x x x x x

(53)

3:51 Bipartite graphs Walter Unger 30.1.2017 12:01 WS2016/17 Z

Example (result)

@

@

@

@@

@

@

@

@@

Q Q Q Q Q QQ Q

Q Q

Q Q

QQ

HH HH HH HH H HH

HH HH

HHH

@

@

@

@@

@

@

@

@@

!!!!!!!!!!!

!!

!!

!!

!!

!!

!

@

@

@

@@

@

@

@

@@

@

@

@

@@

@

@

@

@@

PP PP PP PP PP PP P PP

PP PP

PP PP

PPP

Q Q Q Q Q QQ Q

Q Q

Q Q

QQ

!!!!!!!!!!!

!!

!!

!!

!!

!!

!

Q Q Q Q Q QQ Q

Q Q

Q Q

QQ

Q Q Q Q Q QQ Q

Q Q

Q Q

QQ

HH HH HH HH H HH

HH HH

HHH

@

@

@

@@

@

@

@

@@

aa aa aa aa aa a aa

aa aa

aa aaa

aa aa aa aa aa a aa

aa aa

aa aaa

aa aa aa aa aa a aa

aa aa

aa aaa

!!!!!!!!!!!

!!

!!

!!

!!

!!

!

HH HH HH HH H HH

HH HH

HHH

Q Q Q Q Q QQ Q

Q Q

Q Q

QQ

@

@

@

@@

@

@

@

@@

A A A AA A

A A

AA

PP PP PP PP PP PP P PP

PP PP

PP PP

PPP

| | | | | | | |

| | | | | | | |

(54)

Results

Theorem:

A bipartite graphG with∆(G) =2k can be edge colored with∆(G)colors in timeO(log2n)withO(m)processors.

Proof: See above.

Theorem:

A bipartite graphG can be edge colored with∆(G)colors in timeO(log3n) withO(m)processors.

Proof: See above.

(55)

3:53 ∆ +1 Coloring any Graph Walter Unger 30.1.2017 12:01 WS2016/17 Z

Results without proof

Lemma

Any graphG = (V,E)with maximal degree∆is∆ +1colorable.

Lemma

Any graphG = (V,E), which is not a clique nor a odd cycle is∆colorable.

Idea of distributed/parallel algorithm:

Reduce recursively the colors.

Double the size of correctly colored sub-graphs.

Or use the idea for trees to bounded degree graphs.

(56)

Recall and Idea 1

Theorem:

A tree withnnodes could be colored with nprocessors in timeO(logn)with at most 3 colors.

Recall: choose minimalkwith:((c k)%2)6= ((c0k)%2)and setc=2·k+ ((ck)%2).

This did produce a 6-coloring on trees.

On a bounded degree graph use this idea on a vector of length∆.

(57)

3:55 ∆ +1 Coloring any Graph Walter Unger 30.1.2017 12:01 WS2016/17 Z

Algorithm 1

choose minimalkwith:((ck)%2)6= ((c0k)%2)and setc=2·k+ ((ck)%2) 1 Letv1,v2, ...,vd thed6∆neighbors ofv

2 Letc1,c2, ...,cd the colorsvi andc the color ofv.

3 For eachi (16i6d) do

1 choose minimalki with:((cki)%2)6= ((ci ki)%2)and

2 setbi =2·ki+ ((cki)%2).

4 Choose new color forv:(b1,b2, ...,bd).

As before, the coloring stays valid.

Like before, ax-bit coloring becomes a∆(logx+1)-bit coloring.

Like before, we may reduce the colors to∆ +1 colors.

For unbounded degree the running time becomes:O(logn+2).

(58)

Theorems 1

choose minimalkwith:((ck)%2)6= ((c0k)%2)and setc=2·k+ ((ck)%2)

Theorem

A constant degree graph may be colored with∆ +1colors in timeO(logn) on a distributed system.

Theorem

A constant degree graph may be colored with∆ +1colors in timeO(logn) on a parallel system usingnprocessors.

(59)

3:57 ∆ +1 Coloring any Graph Walter Unger 30.1.2017 12:01 WS2016/17 Z

Notations and Idea 2

choose minimalkwith:((ck)%2)6= ((c0k)%2)and setc=2·k+ ((ck)%2)

x will be a binary string with up tok bits.

DefineUx ={(a1,a2, ...ak−|x|,x)|ai∈ {0,1}}.

The procedure RecurseColor will colorUx with∆ +1 colors.

Idea:

Having coloredUx with∆ +1 colors,

RecolorU1x such thatU0x andU1x are colored correctly.

This doubles the size of correctly colored sub-graphs.

(60)

Recursive Algorithm

Ux={(a1,a2, ...ak−|x|,x)|ai∈ {0,1}}

RecurseColor(x) (initial withx=ε):

1 LetID= (a1,a2, ...,ak)be a vector of bits, which identify the node/prozessorv.

2 Setl=|x|.

3 Ifl=kthen setc(v) =1 and return.

4 Setb=ak−l.

5 Setc(v) =RecurseColor(bx).

6 Ifb=0 then return.

7 For roundi from 1 to∆ +1 do

1 ifc(v) =i thenc(v) =min{1,2, ...∆ +1} \ ∪{v,a}∈E{c(a)}

Theorem

A graph of degree∆may be colored with∆ +1colors in timeO(∆logn)on a distributed/parallel system.

(61)

3:59 Introduction Walter Unger 30.1.2017 12:01 WS2016/17 Z

Independent Set

Ux={(a1,a2, ...ak−|x|,x)|ai∈ {0,1}}

V0⊂V with∀a,b∈V0: (a,b)6∈E is called independent set.

α(G) =max{ |V0|; V0⊂V ∧ ∀a,b∈V0: (a,b)6∈E }.

The problem of finding an independent set of sizen/2 is NP-complete.

A independent setI is call maximal iff there is no larger independent set containingI.

This is called MIS.

Finding the lexicographical first MIS is P-complete.

Coloring and independent set have some relationship.

The nodes of one color form an independent set.

(62)

Independent Set and Coloring

Ux={(a1,a2, ...ak−|x|,x)|ai∈ {0,1}}

Idea: use a coloring to compute a MIS:

1 For all nodes setb(v) =0.

2 For alli from 1 toχ(G)do

1 ifb(v) =0 then setb(v) =1.

2 if some neighbor ofv hasb(v) =1 then setb(v) =−1.

This will produce in time isO(χ(G)).

Referenzen

ÄHNLICHE DOKUMENTE

Theorem 6.11 Das Voronoi Diagramm von n Punkten l¨ aßt sich mit dem Sweep Algorithmus in Zeit O(n log n) und mit Platz O (n). berechnen, das

1:3 Systolic Arrays and Vector Computer Walter Unger 30.1.2017 12:00 WS2016/17 Z..

Explain the number of processors used in the algorithm of

The following algorithm then performs the routing: Packets with color i route from their sources to submesh Mi inside the corresponding column Ab.. In each submesh Mi : Each packet

Thus, these requests can be routed along disjoint paths in B i by our induction hypothesis, so that the Disjoint Path Lemma follows.. We have to show how to choose the subnetworks

The routing time needed by any greedy scheduling policy is at most C · D steps because each packet can be delayed at most for C − 1 steps on each edge on its routing path...

Gossip Introduction First Results Lines Trees Cycles HQ Hypercube CCC and BF Telephone-Mode Odd Number of Nodes Telegraph-Mode Lower Bound Summary Telegraph-Mode Edge Disjoint