0% found this document useful (0 votes)
5 views6 pages

347 Proof #4

The document presents a homework assignment by Akshat Sharma, focusing on flow network problems, specifically using the Ford-Fulkerson algorithm to determine maximum flow in a tripartite graph representing Lego piece distribution for design building. It includes proofs and algorithmic steps to demonstrate the relationship between the flow in the graph and the ability to construct designs with the available Lego pieces. The runtime analysis indicates a polynomial complexity based on the number of vertices and edges in the graph.

Uploaded by

mqm2sn2pb7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views6 pages

347 Proof #4

The document presents a homework assignment by Akshat Sharma, focusing on flow network problems, specifically using the Ford-Fulkerson algorithm to determine maximum flow in a tripartite graph representing Lego piece distribution for design building. It includes proofs and algorithmic steps to demonstrate the relationship between the flow in the graph and the ability to construct designs with the available Lego pieces. The runtime analysis indicates a polynomial complexity based on the number of vertices and edges in the graph.

Uploaded by

mqm2sn2pb7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

homework 4

Akshat Sharma - 466688 - Homework 4

Question 1

A)
If no path with width at least / , then the max net flow out of any s-t cut will be less
than F. Any edge at the boundary of the s-t cut has a residual capacity of 0. As a
result, the back edges will not have any flow, as that is when they have capacity = 0.
On the other hand, this also means that any forward edge has a capacity equal to its
width. Thus, the net flow out of any s-t cut is the sum of all capacities of the outgoing
forward edges. There can be at most m outgoing edges from a given s-t cut, as there
are m edges in the graph. And because each edge can have a width no greater than
/ , the net flow out of any s-t cut would be × < × = .
Because the net flow out of the s-t cut would < , the maximum flow from s to t
would also be < . However, in our premise, we assumed that the maximum flow
would be F. As a result, we arrive at a contradiction. Thus, there must be a path from s
to t with at width at least / .

B)
We know that there must be a path of width ≥ in a graph G with n vertices, m
edges, and a max flow of F based on the proof in part 1a. Based on the fattest path
algorithm, we will end up picking paths of widths ≥ . The flow remaining after this
choice is:

̂= − / = (1 − 1/ )


We also know that 1 − ≤ for 0 ≤ ≤ 1 . In this problem, 0 ≤ , as m
represents the number of edges in the graph. Thus, we also know that for any m,
0 ≤ 1/ ≤ 1 . Plugging this into the first equation, we get that:

−1/
1 − 1/ ≤
−1/
(1 − 1/ ) ≤ ( )

1
𝐹
𝐹
𝑘
𝐹
𝐹
𝐹𝑚
𝐹𝑚
𝐹
𝑥
𝐹
𝐹
𝑚
𝑚
𝑚
𝑚
𝑚
𝑥
𝑚
𝑚
𝑥
𝐹
𝑚
𝑚
𝑒
𝑚
𝐹
𝐹
𝑒
𝑚
𝑚
𝐹
𝐹
𝑒
𝐹
𝑚
̂≤ ( −1/
)

Thus, each time we pick a fattest path to augment, we end up reducing the size of the
maximum flow possible in our graph, while maintaining the same m edges and n
vertices. Applying it again, we get:

̂′ ≤ (̂ −1/
)= ( −1/
)( −1/
)= ( −2/
)

Thus, we see that the numerator increases each time we make a decision on a fattest
path. In order to figure out when the maximum flow is equal to 0, we can rewrite this
expression as:

Akshat Sharma - 466688 - Homework 4

− /
0= , where n is the number of decisions we have made.

Because we must deal with natural logs to solve exponential equations, we cannot get
an appropriate answer out of this expression as is (due to the 0). Instead, we can
solve the following, similar expression:

− /
1=
− /
= 1/
− / = ln(1/ )
=− ln(1/ )
= ln( )

Thus, it takes ln( ) iterations to reach a maximum flow of 1. To get a maximum


flow of size 0, we can just add one more iteration. Thus, because we can disregard
constants, the asymptotic runtime is:

( ln( ) + 1) = ( log ) iterations

2
𝐹
𝐹
𝐹
𝑒
𝑘
𝑘
𝑚
𝑂
𝑛
𝑛
𝑘
𝑘
𝑚
𝑚
𝑚
𝑚
𝑚
𝑚
𝑚
𝑚
𝑚
𝑚
𝐹
𝐹
𝑚
𝐹
𝐹
𝑒
𝑒
𝑚
𝑒
𝐹
𝑒
𝐹
𝐹
𝐹
𝐹
𝐹
𝑂
𝑒
𝑚
𝐹
𝑒
𝐹
𝑒
Question 2

Algorithm

Graph construction

Before solving this problem, we can reimagine it as a tripartite graph, G with source and
sink . The source vertex is the LegoLand warehouse.

The first layer of nodes after the source, 0, corresponds to each of the bins within the
warehouse. By the constraints of the problem, there are n nodes in this layer, each
denoted as from 1… . Each edge from the source to a bin has a capacity
0.05 * | |, where | | is the maximum amount of lego pieces that the bin can hold. The
total amount of blocks from the source is distributed between these buckets, so the flow
is conserved here.

The next layer, 1 represents each kind of lego, from 1… , that is in any given bucket
from the previous layer . As such, there are vertices in this layer. Each edge from a
bucket in 0, , to has a capacity , where is the amount of lego pieces of type
that bin contains. Furthermore, the amount of legos in each bucket is conserved across
the edges, as the legos for a given bucket are distributed to different i. In other words,
= ∑ =1

Akshat Sharma - 466688 - Homework 4

The next layer, 2, represents the pieces required to build a given design from 1… .
Each design needs a total of pieces of type , so the capacity of the edge going from a
piece to a design is . There a total of p designs, so there are p nodes at this layer.
Each of the m verticies on 1 will be used by some design , so the legos are conserved
across these two layers as well.

Finally, each design then feeds into the sink vertex, which is Zach himself. Each of the
edges from the design to the sink has a capacity corresponding to the amount of pieces
from 1 ≤ ≤ that are within the design. In other words, the edge from design to the
sink has a capacity of ∑ =1 = | | . Because each node in 2 takes in lego pieces
from the previous node, the sink will be taking in all of the legos that have been passed
from the source, .

3
𝑏𝑗𝑏
𝐿
𝑆𝑇
𝑛𝑏𝑗
𝑗
𝑖
𝐿
𝑗
𝑏𝑗𝑖𝑏𝑗
𝑏𝑗𝑚𝐿
𝑏𝑗
𝑚𝑖
𝑖𝑏𝑗𝑏𝑗
𝑖
𝑘
𝐿
𝑑𝑘
𝑖𝑖𝑑𝑘𝑑𝑘
𝑑𝑘𝑖
𝑑𝑘
𝐿
𝑑𝑘𝑚𝑖
𝑖
𝑆
𝐿
𝑘
𝑗
𝑘
𝑏
𝑖
𝑖
𝑖
𝑖
𝑚
𝑝
𝑏
𝑖
𝑑
𝑏
𝑚
𝑏
𝑑
Applying Ford-Fulkerson

We can then apply the Ford-Fulkerson algorithm to find the maximum flow possible for a
graph by augmenting the capacity/flow on the forward/back edges of the graph. Once we
have this maximum flow, denoted . We can figure out if Zach will be able to build all of
his designs.

In order for Zach to build all of his designs, he needs to have enough pieces for each of
his designs . As such, this means that the capacities, | | , for each of the edges from
1… flowing into the sink node need to have no residual capacity left. Because the flow
of the graph is just the amount of units flowing out source or into the sink, the flow of the
graph in that scenario would be = ∑ =1 | |

If the maximum flow of the graph, K, equals this value , then Zach will have enough
pieces to build all of this designs and we can return True. Otherwise, the flow from the
bins, to the pieces, to the designs will not be sufficient to build every design, and we can
return False.

Run time:

In general, the fattest-path version of the Ford-Fulkerson algorithm has a polynomial


runtime of Θ(ℎ(| |)| | log ) where V is the number of verticies, E is the number of
edges, and F is the maximum flow within the graph. In this graph, the number of verticies
are simply the number of vertices at each level, =1+ + + + 1 . The number of
edges between two layers can be at most the product of the number of vertices within
each. Thus, we can say that = × × .

Along with the actual algorithm itself, there is a cost of reducing this problem into a graph
format suitable to run the Ford-Fulkerson algorithm on it. This cost lies in the cost of
generating all of the nodes/verticies and edges in the first place. As entioned above, there
are =1+ + + + 1 vertices in the graph and up to = × × edges.
Assuming that creating a node or edge takes constant time, this means that creating the
graph overall is polynomial. This is because there are polynomally many vertices and
edges with respect to the input size.

Akshat Sharma - 466688 - Homework 4

4
𝑑𝑘
𝐾
𝑑
𝑘
𝑝𝑖
𝑝𝐹
𝐹
𝑘
𝑉
𝐸
𝑉
𝐸
𝑑
𝑑
𝑛
𝑛
𝑉
𝑛
𝑛
𝑚
𝑚
𝐸
𝑑
𝑚
𝑚
𝑝
𝑝
𝐹
𝑝
𝑝
Reduction Proof

To apply the Ford-Fulkerson algorithm to this problem, we need first prove the
equivalency between this problem and max-flow problems in general. We claim that Zach
can build all of his designs, which require a total of F pieces, iff the corresponding graph
G has a flow of size F.

Because this is a bidirectional claim, we must prove both sides.

Lego design building → flow

Claim: If Zach takes a maximum of F pieces and can build all of his designs, then the
graph G has a maximum flow of size F.

If Zach is able to build all of his designs, then all of the edges feeding into the sink from
nodes in the previous layer ( in layer 2) will have no residual capacity, as each edge
will have the total amount of pieces needed flowing through. For each design, there are a
number of pieces in layer 1 that feed into it via an edge of capacity . By the
conservation of flow, each lego piece i that flows into a design must have a residual
capacity of 0 as well, as the flow through design is the sum of all the that flow into
it. Going ever more back, we know that each of the pieces i that are within a design must
come from a set of bins, so there are some set of edge between a given piece and a
bin that will have full capacity. This also means that the flow is conserved here as well.
Finally, these bins can also only provide 5% of their size, so because we know that Zach
has made all of his designs successfully, we know that this constraint is fulfilled as well.
Thus, we have a valid flow on graph G. We can verify that this flow has a size of F
because the second to last node that feeds into the sink is composed of F pieces.

Flow → Lego design building

Claim: If graph has a maximum flow of value F, then Zack can take a maximum of F
pieces and can build his design.

5
𝑑𝑖
𝑖𝐿
𝑑𝑘𝐿
𝑑𝑘𝑑𝑘𝑑𝑖
𝑏𝑖
𝑖𝑏𝑗
𝑘
𝑘
𝑗
If we know that our graph has a maximum flow of F, we know that there the sum of the
pieces in all of the designs in the last layer ( in layer 2) must sum up to equal F.
Because we have a valid flow, we know by the convervation of flow that the flow through a
given node in the last layer must be composed of the flow coming from the pieces in
the previous layer 1. Each of these pieces must also have been chosen from a set of
buckets in the previous layer 0 , . Finally, each of these buckets that provided pieces
must have only had 5% of their total capacity removed. To generate a flow of value F,
Zach must have removed F pieces that were all needed in his designs. Otherwise, due to
the conservation of flow, there would not have been a value of F feeding into the sink.

6
𝑏𝑗
𝐿
𝑑𝑘𝑖𝐿
𝑑𝑘𝐿

You might also like