scheduling, map coloring, and graph coloring · l25 4 graph coloring and scheduling one way to do...

45
Scheduling, Map Coloring, and Graph Coloring

Upload: phungliem

Post on 23-Apr-2018

223 views

Category:

Documents


3 download

TRANSCRIPT

Scheduling, Map Coloring, and �Graph Coloring

L25 2

SchedulingviaGraphColoring:FinalExamExample

Supposewanttoschedulesome;inalexamsforCScourseswithfollowingcoursenumbers:

1007,3137,3157,3203,3261,4115,4118,4156Supposealsothattherearenostudentsincommontakingthefollowingpairsofcourses:

1007‐31371007‐3157,3137‐31571007‐32031007‐3261,3137‐3261,3203‐32611007‐4115,3137‐4115,3203‐4115,3261‐41151007‐4118,3137‐41181007‐4156,3137‐4156,3157‐4156Howmanyexamslotsarenecessarytoscheduleexams?

L25 3

GraphColoringandScheduling•  Convertproblemintoagraphcoloringproblem.•  Coursesarerepresentedbyvertices.•  Twoverticesareconnectedwithanedgeifthe

correspondingcourseshaveastudentincommon.

1007

3137

3157

3203

4115

3261

4156

4118

L25 4

GraphColoringandScheduling

Onewaytodothisistoputedgesdownwherestudentsmutuallyexcluded…

1007

3137

3157

3203

4115

3261

4156

4118

L25 5

GraphColoringandScheduling

…andthencomputethecomplementarygraph:

1007

3137

3157

3203

4115

3261

4156

4118

L25 6

GraphColoringandScheduling

…andthencomputethecomplementarygraph:

1007

3137

3157

3203

4115

3261

4156

4118

L25 7

GraphColoringandScheduling

Redrawthegraphforconvenience:

1007

3137

3157

3203

4115

3261

4156 4118

L25 8

GraphColoringandScheduling

Thegraphisobviouslynot1‐colorablebecausethereexistedges.

1007

3137

3157

3203

4115

3261

4156 4118

L25 9

GraphColoringandScheduling

Thegraphisnot2‐colorablebecausethereexisttriangles.

1007

3137

3157

3203

4115

3261

4156 4118

L25 10

GraphColoringandScheduling

Isit3‐colorable?TrytocolorbyRed,Green,Blue.

1007

3137

3157

3203

4115

3261

4156 4118

L25 11

GraphColoringandScheduling

Pickatriangleandcolorthevertices3203‐Red,3157‐Blueand4118‐Green.

1007

3137

3157

3203

4115

3261

4156 4118

L25 12

GraphColoringandScheduling

So4156mustbeBlue:

1007

3137

3157

3203

4115

3261

4156 4118

L25 13

GraphColoringandScheduling

So3261and4115mustbeRed.

1007

3137

3157

3203

4115

3261

4156 4118

L25 14

GraphColoringandScheduling

3137and1007easytocolor–pickBlue.

1007

3137

3157

3203

4115

3261

4156 4118

L25 15

GraphColoringandScheduling

Thereforeweneed3examslots:

1007

3137

3157

3203

4115

3261

4156 4118

Slot1

Slot2

Slot3

MapColoring:5‐ColoringtheContinentalUS

5‐ColorVertexColoringoftheContinentalUS

4‐ColoringoftheContinentalUS:4ColorsSuf;iceforContinuousPlanarMaps

FourColorsSuf;ice

Anarbitrarynumberofcolorsmaybeneededifregionsarenotcontiguous.

Thisexampleneeds5:

SixcolorsmaybeneededifcontinuousregionslieonaMöbiusstrip.

SevencolorsmaybeneededifcontinuousregionslieonaTorus.

BasicTheorems•  HandshakingLemma:

•  Inanygraph,thesumofthedegreesoftheverticesisequaltotwicethenumberofedges.

PlanarHandshakingTheorem

•  Inanyplanargraph,thesumofthedegreesofthefacesisequaltotwicethenumberofedges.

Euler’sFormula

•  InanyconnectedplanargraphwithVvertices,Eedges,andFfaces,

V–E+F=2.

TwoTheorems

•  Twotheoremsareimportantinourapproachtothe4‐colorproblem.

•  The;irstputsandupperboundtothenumberofedgesasimpleplanargraphwithVverticescanhave.

•  Thesecondputsanupperboundonthedegreeofthevertexofsmallestdegree.

Verticesofdegree≤5

The6­ColorTheorem:Everysimpleconnectedplanargraphis6‐colorable.

Consideragraphwith(k+1)vertices.FindV*withdegree5orless

RemoveV*andallincidentedges.Theresultingsubgraphhaskvertices.Thereforeit

canbe5‐colored.

ReplaceV*andincidentedges.Sincewehave6colorsavailableandatmost5adjacentvertices,usethe

remainingcolorforV*.

The5­ColorTheorem:Allconnectedsimpleplanargraphsare5colorable.Proofbyinductiononthenumberofvertices.

•  BaseCase:Anyconnectedsimpleplanargraphwith5orfewerverticesis5‐colorable.

•  InductionHypothesis:Assumeeveryconnectedsimpleplanargraphswithkverticesis5‐colorable.

•  Proveforagraphwithk+1vertices.

LetGbeanSCPgraphwith(k+1)vertices.Itcontainsatleastonevertex,V*,withdegree5orless.

•  Removethisvertexandalledgesincidenttoit.•  Bytheinductionhypothesistheremaininggraphwithkverticesis5‐colorable.

Colorthisgraphwith5colors.

ReplaceV*andtheincidentedges.WecancolorV*onlyifitsadjacentverticesdonotuseall5colors.Thereforeassumeall5colorsarealreadyused.

ConsiderallG‐MpathsleadingoutofV*(pathsthatalternateGreen‐Magenta‐Green‐

Magenta…)

IfthereisnoconnectedpathleadingbacktoV*thenswitchMandG,andcolorV*Green.

Ifthereexistsaconnectedpath,thenswitchingdoesnothelp.

IsthereaRed‐Blueconnectingpath?

Ifnot,switchtheRedandBluecoloredverticesandcolorV*Red.

ThereforeassumethatthereexistsaRed‐Blueconnectingpath.

IfthereisaRed‐BlueChain,therecannotbeaBlack–GreenChain,sinceitisblockedbytheRed‐BlueChain.

ThenswitchthecolorsoftheBlack–GreenchainandcolorV*Black