432
Chapter9 GraphAlgorithms
G
J
I
H
F
C
A
B
D
E
How to add pdf to powerpoint presentation - C# Create PDF from PowerPoint Library to convert pptx, ppt to PDF in C#.net, ASP.NET MVC, WinForms, WPF
Online C# Tutorial for Creating PDF from Microsoft PowerPoint Presentation
drag and drop pdf into powerpoint; pdf picture to powerpoint
How to add pdf to powerpoint presentation - VB.NET Create PDF from PowerPoint Library to convert pptx, ppt to PDF in vb.net, ASP.NET MVC, WinForms, WPF
VB.NET Tutorial for Export PDF file from Microsoft Office PowerPoint
convert pdf file to powerpoint; how to convert pdf to powerpoint in
nwewilltakeabrieflookatthisproblem.Thistopicisrathercomplex,
keaquickandinformallookatit.Becauseofthis,thediscussionmaybe
ewhatimpreciseinplaces.
hatthereareahostofimportantproblemsthatareroughlyequivalent
eseproblemsformaclasscalledtheNP-completeproblems.Theexact
eseNP-complete problems has yettobedetermined andremains the
oblemintheoreticalcomputerscience.Eitheralltheseproblemshave
solutionsornoneofthemdo.
VB.NET PowerPoint: Use PowerPoint SDK to Create, Load and Save PPT
an empty PowerPoint file with our reliable .NET PPT document add-on; a fully customized blank PowerPoint file by using the smart PowerPoint presentation control
change pdf to powerpoint on; convert pdf into powerpoint
VB.NET PowerPoint: Sort and Reorder PowerPoint Slides by Using VB.
index = 1 End If correctOrder.Add(index) Next clip art or screenshot to PowerPoint document slide powerful & profession imaging controls, PDF document, image
convert pdf to powerpoint online for; copying image from pdf to powerpoint
andwearriveat thesamesetofcontradictions.Thus,weseethattheprogramLOOP
cannotpossiblyexist.
9.7.2 TheClassNP
AfewstepsdownfromthehorrorsofundecidableproblemsliestheclassNP.NPstands
fornondeterministicpolynomial-time.Adeterministicmachine,ateachpointintime,is
executinganinstruction.Dependingontheinstruction,itthengoestosomenextinstruc-
tion,whichisunique.Anondeterministicmachinehasachoiceofnextsteps.Itisfreeto
VB.NET PowerPoint: VB Codes to Create Linear and 2D Barcodes on
Here is a market-leading PowerPoint barcode add-on within VB.NET class, which means it as well as 2d barcodes QR Code, Data Matrix, PDF-417, etc.
converting pdf to powerpoint online; convert pdf into powerpoint online
VB.NET PowerPoint: Merge and Split PowerPoint Document(s) with PPT
For Each doc As [String] In dirs docList.Add(doc) Next code in VB.NET to finish PowerPoint document splitting If you want to see more PDF processing functions
pdf to ppt converter online for large; how to convert pdf into powerpoint presentation
,canbereducedtoP
2
asfollows:Provideamappingsothatanyinstance
sformedtoaninstanceofP
2
.SolveP
2
,andthenmaptheanswerback
sanexample,numbersareenteredintoapocketcalculatorindecimal.
bersareconvertedtobinary,andallcalculationsareperformedinbinary.
swerisconvertedbacktodecimalfordisplay.ForP
1
tobepolynomially
lltheworkassociatedwiththetransformationsmustbeperformedin
hatNP-completeproblemsarethehardestNPproblemsisthataprob-
mpletecanessentiallybeusedasasubroutineforanyprobleminNP,
VB.NET PowerPoint: Add Image to PowerPoint Document Slide/Page
of "AddPage", "InsertPage" and "DeletePage" to add, insert or delete any certain PowerPoint slide without & profession imaging controls, PDF document, tiff
how to convert pdf file to powerpoint presentation; how to convert pdf to ppt using
C# PDF Text Extract Library: extract text content from PDF file in
text content from source PDF document file for word processing, presentation and desktop How to C#: Extract Text Content from PDF File. Add necessary references
how to change pdf file to powerpoint; image from pdf to ppt
V1
V2
V3
V4
V5
V1
V2
V3
V4
V5
1
1
2
1
2
1
2
1
2
1
Figure9.80 Hamiltoniancycleproblemtransformedtotravelingsalesmanproblem
problemsareconsideredbeforetheproblemthatactuallyprovidesthereduction.Aswe
areonlyinterestedinthegeneralideas,wewillnotshowanymoretransformations;the
interestedreadercanconsultthereferences.
ThealertreadermaybewonderinghowthefirstNP-completeproblemwasactually
proventobeNP-complete.SinceprovingthataproblemisNP-completerequirestrans-
formingitfromanotherNP-completeproblem,theremustbesomeNP-completeproblem
forwhichthisstrategywillnotwork.ThefirstproblemthatwasproventobeNP-complete
wasthesatisfiabilityproblem.ThesatisfiabilityproblemtakesasinputaBooleanexpres-
sionandaskswhethertheexpressionhasanassignmenttothevariablesthatgivesavalue
of
true
.
SatisfiabilityiscertainlyinNP,sinceitiseasytoevaluateaBooleanexpressionand
checkwhethertheresultistrue.In1971,CookshowedthatsatisfiabilitywasNP-complete
bydirectlyproving thatallproblemsthatareinNPcouldbetransformedtosatisfiabi-
lity.Todothis,heusedtheoneknownfactabouteveryprobleminNP:Everyproblem
in NP can besolvedin polynomialtime bya nondeterministic computer.Theformal
modelforacomputerisknown asaTuring machine.Cookshowedhow theactions
of this machine could d be e simulated d by y an extremely complicated and d long, but t still
polynomial,Boolean formula. This s Boolean formula would be true if and only ifthe
programwhichwas beingrunby theTuring machineproduceda“yes”answerforits
input.
OncesatisfiabilitywasshowntobeNP-complete,ahostofnewNP-completeproblems,
includingsomeofthemostclassicproblems,werealsoshowntobeNP-complete.
Inadditiontothesatisfiability,Hamiltoniancircuit,travelingsalesman,andlongest-
path problems,which wehave already examined,some of themorewell-known NP-
completeproblemswhichwehavenotdiscussedarebinpacking,knapsack,graphcoloring,
and clique. The list t is s quite extensiveand d includes s problems fromoperating systems
(scheduling and security),databasesystems, , operationsresearch,logic,and d especially
graphtheory.
C# Create PDF from OpenOffice to convert odt, odp files to PDF in
In order to run the sample codes, the following steps would be necessary. Add necessary references: RasterEdge.XDoc.PDF.dll. RasterEdge.XDoc.PowerPoint.dll.
and paste pdf to powerpoint; converting pdf to ppt online
VB.NET Create PDF from OpenOffice to convert odt, odp files to PDF
In order to run the sample codes, the following steps would be necessary. Add necessary references: RasterEdge.XDoc.PDF.dll. RasterEdge.XDoc.PowerPoint.dll.
convert pdf pages into powerpoint slides; pdf conversion to powerpoint
Exercises
437
Summary
Inthischapterwehaveseenhowgraphscanbeusedtomodelmanyreal-lifeproblems.
Manyofthegraphsthatoccuraretypicallyverysparse,soitisimportanttopayattention
tothedatastructuresthatareusedtoimplementthem.
Wehavealsoseenaclassofproblemsthatdonotseemtohaveefficientsolutions.In
Chapter10,sometechniquesfordealingwiththeseproblemswillbediscussed.
Exercises
9.1
FindatopologicalorderingforthegraphinFigure9.81.
9.2
IfastackisusedinsteadofaqueueforthetopologicalsortalgorithminSection9.2,
does a different ordering result? Why might onedatastructure give a“better”
answer?
9.3
Writeaprogramtoperformatopologicalsortonagraph.
9.4
AnadjacencymatrixrequiresO(|V|2)merelytoinitializeusingastandarddouble
loop.Proposeamethodthatstoresagraphinanadjacencymatrix(sothattesting
fortheexistenceofanedgeisO(1))butavoidsthequadraticrunningtime.
9.5
a. FindtheshortestpathfromAtoallotherverticesforthegraphinFigure9.82.
b.FindtheshortestunweightedpathfromBtoallotherverticesforthegraphin
Figure9.82.
9.6
Whatistheworst-caserunning timeofDijkstra’salgorithmwhenimplemented
withd-heaps(Section6.5)?
9.7
a. Givean n example where Dijkstra’s algorithm m gives the wrong answer in the
presenceofanegativeedgebutnonegative-costcycle.
b.Show that the weighted d shortest-path algorithm m suggested in Section 9.3.3
worksiftherearenegative-weightedges,butnonegative-costcycles,andthat
therunningtimeofthisalgorithmisO(|E|·|V|).
s
A
D
G
B
E
H
C
F
I
t
1
4
6
2
2
3
3
2
1
6
2
2
3
3
2
6
4
1
3
1
4
Figure9.81 GraphusedinExercises9.1and9.11
438
Chapter9 GraphAlgorithms
A
B
C
D
E
F
G
5
3
2
1
3
7
2
1
6
7
1
2
Figure9.82 GraphusedinExercise9.5
9.8
Supposealltheedgeweightsinagraphareintegersbetween1and|E|.Howfast
canDijkstra’salgorithmbeimplemented?
9.9
Writeaprogramtosolvethesingle-sourceshortest-pathproblem.
9.10 a. ExplainhowtomodifyDijkstra’salgorithmtoproduceacountofthenumberof
differentminimumpathsfromvtow.
b.ExplainhowtomodifyDijkstra’salgorithmsothatifthereismorethan one
minimumpathfromvtow,apathwiththefewestnumberofedgesischosen.
9.11 FindthemaximumflowinthenetworkofFigure9.81.
9.12 SupposethatG= (V,E)isatree,sistheroot,andweaddavertextandedges
ofinfinitecapacityfromallleavesinGtot.Givealinear-timealgorithmtofinda
maximumflowfromstot.
9.13 Abipartitegraph,G=(V,E),isagraphsuchthatVcanbepartitionedintotwo
subsets,V
1
andV
2
,andnoedgehasbothitsverticesinthesamesubset.
a. Givealinearalgorithmtodeterminewhetheragraphisbipartite.
b.ThebipartitematchingproblemistofindthelargestsubsetE
ofEsuchthatno
vertexisincludedinmorethanoneedge.Amatchingoffouredges(indicated
bydashededges)isshowninFigure9.83.Thereisamatchingoffiveedges,
whichismaximum.
Showhowthebipartitematchingproblemcanbeusedtosolvethefollowingprob-
lem:Wehaveasetofinstructors,asetofcourses,andalistofcoursesthateach
instructorisqualifiedtoteach.Ifnoinstructorisrequiredtoteachmorethanone
course,andonlyoneinstructormayteachagivencourse,whatisthemaximum
numberofcoursesthatcanbeoffered?
c. Showthatthenetworkflowproblemcanbeusedtosolvethebipartitematching
problem.
d.Whatisthetimecomplexityofyoursolutiontopart(b)?
Exercises
439
Figure9.83 Abipartitegraph
9.14 a. Giveanalgorithmtofindanaugmentingpaththatpermitsthemaximumflow.
b.Letbetheamountofflowremainingin theresidualgraph.Show thatthe
augmentingpathproducedbythealgorithminpart(a)admitsapathofcapacity
f/|E|.
c. Showthatafter|E|consecutiveiterations,thetotalflowremainingintheresidual
graphisreducedfromftoatmostf/e,wheree≈2.71828.
d.Showthat|E|lnfiterationssufficetoproducethemaximumflow.
9.15 a. FindaminimumspanningtreeforthegraphinFigure9.84usingbothPrim’s
andKruskal’salgorithms.
b.Isthisminimumspanningtreeunique?Why?
9.16 DoeseitherPrim’sorKruskal’salgorithmworkiftherearenegativeedgeweights?
9.17 ShowthatagraphofVverticescanhaveV
V−2
minimumspanningtrees.
9.18 WriteaprogramtoimplementKruskal’salgorithm.
9.19 Ifalloftheedgesinagraphhaveweightsbetween1and|E|,howfastcanthe
minimumspanningtreebecomputed?
A
B
C
D
E
F
G
H
I
J
4
5
6
4
2
3
2
11
1
4
3
3
10
6
2
11
7
1
8
Figure9.84 GraphusedinExercise9.15
440
Chapter9 GraphAlgorithms
A
B
C
D
E
F
G
H
I
J
K
Figure9.85 GraphusedinExercise9.21
9.20 Giveanalgorithmtofindamaximumspanningtree.Isthisharderthanfindinga
minimumspanningtree?
9.21 FindallthearticulationpointsinthegraphinFigure9.85.Showthedepth-first
spanningtreeandthevaluesofNumandLowforeachvertex.
9.22 Provethatthealgorithmtofindarticulationpointsworks.
9.23 a. Giveanalgorithmtofindtheminimumnumberofedgesthatneedtoberemo-
vedfromanundirectedgraphsothattheresultinggraphisacyclic.
b.ShowthatthisproblemisNP-completefordirectedgraphs.
9.24 Provethatinadepth-firstspanningforestofadirectedgraph,allcrossedgesgo
fromrighttoleft.
9.25 Giveanalgorithmtodecidewhetheranedge(v,w)inadepth-firstspanningforest
ofadirectedgraphisatree,back,cross,orforwardedge.
9.26 FindthestronglyconnectedcomponentsinthegraphofFigure9.86.
A
B
C
D
E
F
G
Figure9.86 GraphusedinExercise9.26
Exercises
441
9.27 Writeaprogramtofindthestronglyconnectedcomponentsinadigraph.
9.28 Giveanalgorithmthatfindsthestronglyconnectedcomponentsinonlyonedepth-
firstsearch.Useanalgorithmsimilartothebiconnectivityalgorithm.
9.29 Thebiconnectedcomponentsofagraph,G,isapartitionoftheedgesintosetssuch
thatthegraphformedbyeachsetofedgesisbiconnected.Modifythealgorithmin
Figure9.69tofindthebiconnectedcomponentsinsteadofthearticulationpoints.
9.30 Supposeweperformabreadth-firstsearchofanundirected graph andbuild a
breadth-firstspanningtree.Showthatalledgesinthetreeareeithertreeedgesor
crossedges.
9.31 Givean algorithmtofind in an undirected(connected)graphapaththatgoes
througheveryedgeexactlyonceineachdirection.
9.32 a. WriteaprogramtofindanEulercircuitinagraphifoneexists.
b.WriteaprogramtofindanEulertourinagraphifoneexists.
9.33 AnEulercircuitinadirectedgraphisacycleinwhicheveryedgeisvisitedexactly
once.
a. Provethata directedgraphhas an n Eulercircuitif and only if it is strongly
connectedandeveryvertexhasequalindegreeandoutdegree.
b.Givealinear-timealgorithmtofindanEulercircuitinadirectedgraphwhere
oneexists.
9.34 a. ConsiderthefollowingsolutiontotheEulercircuitproblem:Assumethatthe
graphisbiconnected.Performadepth-firstsearch,takingbackedgesonlyasa
lastresort.Ifthegraphisnotbiconnected,applythealgorithmrecursivelyon
thebiconnectedcomponents.Doesthisalgorithmwork?
b.Supposethatwhentaking backedges,wetakethebackedgetothenearest
ancestor.Doesthealgorithmwork?
9.35 Aplanargraphisagraphthatcanbedrawninaplanewithoutanytwoedges
intersecting.
a. ShowthatneitherofthegraphsinFigure9.87isplanar.
b.Showthatinaplanargraph,theremustexistsomevertexwhichisconnected
tonomorethanfivenodes.

c. Showthatinaplanargraph,|E|≤3|V|−6.
Figure9.87 GraphusedinExercise9.35
Documents you may be interested
Documents you may be interested