6 views

Uploaded by Alex Wang

problem set

- 12
- Beamerexample Conference Talk
- Simplex Method
- A syllabus
- TA ZC142-L7
- Introduction to computer systems architecture and programming
- CS449_Syllabus-Algorithms & Complexity
- Intro to Quantitative Analysis
- sli06
- slide-6-networks.pptx
- Part Matchings
- An Introduction to Management Science
- CS70 Midterm
- Book List
- 528218
- 12270_46414_DAA lab cycle
- assig
- Main
- Lecture 01 Intro
- Linear Cyclic Snakes as Super Vertex Mean Graphs

You are on page 1of 5

Alex Wang

November 17, 2016

Problem A

1.1

Description

First, for connect an edge from each store to any house within a one hour radius. Each

edge will have a capacity of 1. Next, connect edges from a super-source s to each store and

assign each edge to have a capacity of d nk e. Then connect all the houses to a super-sink

t each with an edge capacity of 1. Once the graph is created, run the Ford-Fulkerson

algorithm and check to see if the max-flow is equal to n, the number of houses. If max-flow

does equal n then that means its possible for each parent to get a toy without driving for

more than an hour to the store.

1.2

Pseudocode

Function buildGraph()

Initialize n houses and k stores Connect edges from each store to all houses

within an hour drive. Initiate all of these edges with capacity c(e) = 1

Initialize super-source s. Connect edges from s to each store each with a

capacity c(e) = d nk e

Initialize sink t. Connect edges from each house to the super sink each with a

capacity c(e) = 1

Let G = buildGraph()

if Ford-Fulkerson max-flow is equal to n then

return True

end

else

return False

end

1.3

Time Analysis

We assume that connecting a single edge takes O(1) time. Connecting each store to all

of the houses within its vicinity, in the worst-case scenario, O(kn) time. We also have to

connect the super-source to all the supply nodes( O(k) ) and each house to the sink ( O(n) ).

And lastly, running the Ford-Fulkerson algorithm will take O(mF ) where m is the number

of edges and F is the maximum flow. In this problem, the number of edges is kn + k + n

and the maximum possible flow is n. So the total runtime for running the Ford-Fulkerson

algorithm is O(kn + k + n) = O(kn2 + kn + n2 ) = O(n2 ). Now the total runtime of building

the graph then running the Ford-Fulkerson algorithm on it is O(kn + n + k + n2 = O(n2 ).

1.4

Proof of Correctness

Proof. We first need to show that if there is a max-flow value of n, then there is a valid

matching between the parents and a store and there cannot be a store with more than

d nk e parents. Since there is a max-flow of n, that means the total capacity of all the edges

coming from the parent nodes going into the sink is n. Since there are n parents total,

this means that capacity of all of these edges must be n/n = 1. Because 1 unit of flow is

coming out of each parent, 1 unit of flow must be going into each parent and each of these

edges is coming from a store which means there is a matching between stores and parents.

Now we need to show that a store cannot be connected to more than d nk e parents. If there

are more than d nk e parents connected to a given store, then that means there are more than

d nk e units of flow going into that store. But we are given that each store has a maximum

of d nk e units flowing into them from the source. So, there cannot be more than d nk e parents

connected to any given store.

Therefore, if there is a max-flow value of n, then there is a valid matching between the

parents and a store.

Proof. Next, we need to show that if there is a valid matching between the parents and a

store, then there is a max-flow value of n. For any valid matching between some store ri

2

and some parent pj , we send one unit of flow between the store and the parent. This unit

of flow ultimately comes from the source node s. Then from the parent to the sink t, we

send one unit of flow. And now we have a single path starting from source s to ri to pj to

t. Because there are n parent nodes, there n such paths going into the sink. Therefore,

the maximum flow is n.

Problem B

2.1

Description

The problem we are trying to solve is to see if we can find k vertex disjoint paths starting

at one of the k nodes and ending at a border node. First take the current graph G and

split each node v such that there is a vin node and a vout node; set the edge capacity

between them to be 1. Connect a source s to all the k nodes kin nodes and set their edge

capacity to be 1. Let u be any other node within vs vicinity. Create an edge (v, u) by

connecting vout and uin and set this edge capacity to 1. If v is a border node, then connect

vout to a sink t and once again set this edge capacity to be 1.

Now that we have built a graph, run the Ford-Fulkerson algorithm on it. If the max-flow is

equal to k, then it is possible to evacuate people from those k locations to the city border.

2.2

Pseudocode

Function buildGraph(G)

Let G0 = splitted version graph G with edge capacity of 1 between vin and vout

Let s and t be super-source and sink respectively

Connect source s to all the kin nodes with edge capacity of 1

Let u be any node within vs vicinity

if v is a border node then

Connect vout to sink t with edge capacity of 1

end

else

Connect vout to uin with edge capacity of 1

end

return G0

Function determinePossibility()

Let G = buildGraph()

if Ford-Fulkerson max-flow is equal to k then

return True

end

else

return False

end

2.3

Time Analysis

We will assume adding an edge or splitting a node takes O(1) time. The total number of

nodes in a graph of m n is (n + 1)(m + 1) so the runtime is O(mn + n + m). All of these

nodes will then all be connected to either another node or the sink but the runtime will

remain O(mn + n + m). Since there are k starting locations, connecting the source to each

one of these will take O(k) time and since there will be k border nodes there are k nodes to

connect to the sink. The total running time of building this graph is O(mn + n + m + 2k)

And finally, running the Ford-Fulkerson algorithm will take O(EF ) where E = m(n + 1) +

n(m + 1) and F = k. Therefore, the total running time is O(EF ) + O(mn + n + m + 2k) =

O([mn + n + m]k + mn + n + m + k) = O([mn + n + m]k)

2.4

Proof of Correctness

Proof. We need to show that if the max-flow = k then there are k vertex disjoint paths.

There are k units of flow leaving the source and that is being distributed among k vertices

so each edge has a capacity of 1. And because we added an edge with capacity of 1 between

vin and vout , that vertex cannot be visited again. From this point onward, every edge added

will have a capacity of 1 so there is no possibility of any vertex being visited more than

once. The result is there are k vertex-disjoint paths because the edge capacities throughout

the path are all equal to 1.

Proof. Now we need to show that if there are k vertex disjoint paths then the max-flow is

k. A vertex disjoint path is a path where they do not share any nodes except the last one.

We know that there are k paths going into the sink and throughout each path all the edge

capacities are equal to 1. Therefore, there must be k units of flow leaving the source and

the max-flow is k. If the max-flow does not equal to k, then that means that units of flow

were either lost or created while going from the source to the sink.

Collaboration

Daniel Washburn, Kevin Liao, Erin Lipman, Audrey Lin

- 12Uploaded byMuthu Vijay Deepak
- Beamerexample Conference TalkUploaded byMarcelampbt
- Simplex MethodUploaded byZachary
- A syllabusUploaded byMichael Hughes
- TA ZC142-L7Uploaded byrajpd28
- Introduction to computer systems architecture and programmingUploaded byRohitGupta
- CS449_Syllabus-Algorithms & ComplexityUploaded byLaura Craig
- Intro to Quantitative AnalysisUploaded byAaronLumibao
- sli06Uploaded byAntonio Carlos Salzvedel Furtado
- slide-6-networks.pptxUploaded bykhamaludin
- Part MatchingsUploaded byhisuin
- An Introduction to Management ScienceUploaded byVishal Naik
- CS70 MidtermUploaded byDan Goodman
- Book ListUploaded byAnkur Verma
- 528218Uploaded byAvinashRai
- 12270_46414_DAA lab cycleUploaded byroja
- assigUploaded byVince Bagsit Policarpio
- MainUploaded bydeathlyhallows2011
- Lecture 01 IntroUploaded byKrishna Kant
- Linear Cyclic Snakes as Super Vertex Mean GraphsUploaded byIoan Degau
- RecurrenceUploaded byTrisha_csedu
- eCo: Managing a Library of Reusable Behaviours (Poster ICCBR 2012)Uploaded bys0ulboy05
- ch1.pptUploaded byAshok Sharma
- Sec AUploaded byroufix
- csc263Uploaded byhitman047
- merlin mathematics forum tutoring in montreal technology mathUploaded byMath Tutor
- Routing ProblemsUploaded byJeff Gurguri
- COM Example 7Uploaded byALI HAIDER
- Algorithmic Decision Theory - ADT 2011.pdfUploaded bymarcolof
- COM Example 6Uploaded byALI HAIDER

- TDA8561QUploaded byKarlitos Belt Gar
- History of AviationUploaded byUtsav Niroula
- Yale 13500Uploaded byVitorMello
- Guias 2013 SeahawksUploaded byJj So
- Program Control InstructionsUploaded byMANIKANDAN
- MI6_ Inside the Covert World of Her Majesty's Secret Intelligence ServiceUploaded byfowey1
- Blue Ocean Strategy Project ReportUploaded byarpit vora
- List Buku Yg Xdak (Include Price)- 2016Uploaded bySurhan
- AIE2025 Consultation Workshop ReportUploaded byDjoZy Evra
- Materiality in Government AuditingUploaded byInternational Consortium on Governmental Financial Management
- 1.Laganapan vs. AsedilloUploaded byJuliefe Cuenca
- rUploaded byVenkatesha Hebbar
- Problem StatementUploaded byAnam Khan
- Logic Model Guide PDFUploaded byMeredith Liu
- Isaak Mentouri Discloses Disruptive Path to Four Year Collegiate Degree: What Universities Don't Want you to KnowUploaded byPR.com
- Hdfc Statment 2018 2019Uploaded byDelhi Police
- McSeedy Theme #25Uploaded byPaw Cortez
- Banking and Currency and the Money Trust by Charles A Lindbergh SrUploaded bymrpoisson
- feasability proposalUploaded byapi-340734102
- Artigo - Absorption Properties of Twinned SiC Nanowires Reinforced Si3N4 Composites Fabricated by 3D-PriningUploaded byAntonio Silva
- EU Omron Corporate Profile BrochureUploaded byOmron Industrial Automation
- SuppBrief, APPENDIX Senior Status, Feb-13-2013, Petition 12-7747Uploaded byNeil Gillespie
- Site Catalyst 13.5 User ManualUploaded bykushin
- VotingPrimer2000Uploaded bysojitradarshak
- britishdiplomatsdirectory.pdfUploaded byahmad ghalandari
- INDUSTRIAL AUTOMATION 1 - אוטומציה תעשייתית 1Uploaded byMichael
- Employee Benefits Director Manager In New York City Resume Michael HarrisUploaded byMichael Harris
- STFC Prospectus FinalUploaded bymeenakshi_kumari36
- CrystalChoiceForTransmission (1).pdfUploaded byJohn Tyler Kaufman
- Andersson_2016_BJSM_Preventing Overuse Shoulder Injuries Among Throwing AthletesUploaded bymk78_in