An outline of the lecture is given below.
Big-O notation and its relatives are used to characterize the complexity of algorithms.
Let f and g be functions from the natural numbers to the natural numbers.
We say f(n0=O(g(n) (f(n) is big-O (or of order) g(n)) if there
are positive constants c and such that
for
all
. Informally, f grows no faster than g.
Big-O notation is used to describe the (worst case) complexity of
an algorithm.
Big-omega is used to describe that f grows no slower than g and would be used to describe the best case behavior of an algorithm or the inherent complexity of a problem. Big-theta is use to say f grows at the same rate as g.
The class of problems that can be solved in a polynomial number of steps in the size of the input. Algorithms to solve problems are executed on (deterministic) Turing machines.
A language L is a subset of the set of all strings over a finite
alphabet. ``Problems'' can be encoded as languages.
For example, a graph with n vertices can be represented as an
adjacency matrix. Thus we can encode a graph as a string:
the decimal number n, followed by a separator (say #), followed
by a string of 0's and 1's of length .
A decision problem asks a question that requires a ``yes'' or ``no'' answer. REACHABILITY is an example
REACHABILITY: Given a graph and two nodes
,
is there a path from 1 to n?
(All graphs will be finite and directed)
The search algorithm solves REACHABILITY.
REACH
;
while do
remove i from S;
mark i;
for each edge where j is not marked
insert j in S;
end for;
end while;
if n is marked return yes;
else return no;
Questions to consider
An optimization problem uses an objective function (cost criterion) to seek the best among many possible solutions to a problem. Any optimization problem can be transformed to a decision problem by supplying a target value.
MAX FLOW is an optimization problem on a network.
A network is a graph
with
two distinguished nodes s (the source) and t (the sink)
and an integer capacity
for each edge
.
Additionally, the source s has no incoming edges and the sink t
has no outgoing edges.
A flow in network N is a function
satisfying
MAX FLOW: Given a network, find a flow of largest possible value.
A ``cut'' in a network N=(V, E, s, t, c) is a set S such that the source is in S but the sink is not. The capacity of a cut is the sum of the capacities of all edges going out of S. The flow of a network is at least as large as the capacity of the capacity of any cut.
Let f be a flow. If f is not optimal and f' is another flow of greater
value the is a flow with positive value, but it
may have negative flows along some edges (i, j), which can be
thought of as a positive flow along the ``reverse'' edge.
If ,
then
If
,
then
is a flow of the derived network N(f)=(V,E,s, t, c') where
and
c'(i,j) = c(i,j) - f(i,j)
for
and
c'(i,j) = f(j,i)
for
.
Deciding if a flow is optimal is the same as deciding whether there is a no positive flow in the derived network N(f). That is, showing t is not reachable from s. The MAX FLOW problem has been reduced to repeatedly solving REACHABILITY.
MAXFLOW
for each edge set f(i,j)=0
constructs derived network N(f)
while t is reachable from s
find smallest capacity c' along N(f)'s path from s to t
add c' to the value of f on all edges of the path
constructs derived network N(f)
end while
return f;
What is the time complexity? Reachability and augmenting the flow is
. Each iteration increases the flow by at least 1.
The maximum flow is at most nC where n is the number of vertices
(not counting the source and sink) and C is the maximum capacity of any
edge. The complexity is thus
.
Note the dependency on C can make this a non-polynomial algorithm.
There are algorithms for MAXFLOW that are polynomial.
The text gives a algorithm.
Note the algorithm requires considerable extra space, about to
store the current flow.
Problems in the class NP can be solved in polynomial time on a non-deterministic Turing machine. A nice intuitive definition is that solutions to such problems can be ``checked'' quickly, but it may be time consuming to generate a solution.
The traveling salesman problem (TSP): given a finite set of ``cities''
and ``distances''
between each pair of cities,
and a bound
is there a ``tour'' of all cities
having total length no more than B?
William D. Shoaff
Comments to author:wds@cs.fit.edu
All contents copyright ©, William D. Shoaff
Revised: Mon Jan 12 13:51:11 EST 1998