Professional Documents
Culture Documents
1 Basics of Networks
1 Basics of Networks
Bakal 1
1 Basics of Networks
Networks are everywhere. Example networks: Electrical and power networks, tele-
phone, highway systems, airline and rail networks, manufacturing and distribution
systems, computer networks
In each of these examples, the aim is to move some entity from one point to
another in the most efficient way possible using the underlying network.
In the first part of this course, we will model various settings as network flow
problems, and study a number of algorithms to solve the resulting models. The main
question is: if we have alternative ways to use a network, which alternative will be
the most cost-effective?
1. Minimum Spanning Tree Problem: What is the best way to connect a number
of points as cheaply as possible?
• Scheduling problems
First paper on graph theory was published by Leonhard Euler, a Swiss mathe-
matician, in 1736:
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 2
The Seven Bridges of Konigsberg: The river Pregel runs through the town of
Konigsberg. In the river are two islands, connected to each other and the rest of the
city by seven bridges (See the figure below). Is it possible to start at some place in
the city, cross every bridge exactly once, and return to the starting point?
Land
Island Island
Land
i: Initial node
i j j: Terminal Node
Let (i, j) be a directed arc. Then, i is the tail of the arc, and j is its head. Arc (i, j)
is incident to nodes i and j. It is an outgoing arc of node i, and an incoming arc of
node j. Node j is adjacent to node i.
An example network:
2 4
1
5 7
3 6
N = {1, 2, 3, 4, 5, 6, 7}
A = {(1, 2), (1, 3), (2, 3), (2, 4), (3, 6), (4, 5), (4, 7), (5, 2), (5, 3), (5, 7), (6, 7)}
Degrees: The indegree of a node is the number of incoming arcs to that node. Its
outdegree is the number of outgoing arcs. Degree = Indegree + Outdegree
Arc Adjacency List: The arc adjacency list A(i) of node i is the set of arcs ema-
nating from node i. That is, A(i) =
Node Adjacency List: The node adjacency list A(i) of node i is the set of nodes
adjacent to node i. That is, A(i) =
2 4
2
1
5
1
5 7
Directed Walk: A directed walk is a walk such that for two consecutive nodes ik
and ik+1 on the walk (ik , ik+1 ) ∈ A.
Directed Path: A directed path is a directed walk without any repetition of nodes.
A (directed) path can be stored using a predecessor index.
5 7 2 4
3 6 5
Connectivity: Two nodes i and j are connected if the graph contains at least one
path from node i to node j. A graph is connected if every pair of its nodes is connected.
A connected graph is strongly connected if it contains at least one directed path from
every node to every other node.
Cut: A cut is a partition of the node set N into two parts, S and S̄ = N − S. Each
cut defines a set of arcs consisting of those arcs that have one endpoint in S and
another endpoint in S̄.
2 4
1
5 7
{(2,4),(5,2),(5,3),(3,6)}
3 6
Tree: A tree is a connected graph that contains no cycle. A tree of n nodes contains
exactly n − 1 arcs. A tree has at least two leaf nodes (nodes with degree 1). Every
two nodes of a tree are connected by a unique path.
Rooted Tree: A rooted tree is a tree with a specially designated node, its root; we
regard a rooted tree as though it were hanging from its root.
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 5
2 4 5
3 6 7
Directed-out Tree: A tree is a directed-out tree rooted at node s if the unique path
in the tree from s to every other node is directed.
2 4
1
5 7
3 6
Fundamental Cuts: Let T be a spanning tree of graph G. The deletion of any tree
arc of T produces a disconnected graph containing two subtrees, T1 and T2 . Arcs
whose endpoints belong to the different subtrees constitute a fundamental cut of G
with respect to T . The network has n − 1 fundamental cuts with respect to any tree.
1 5
7 3
4 8
6 2
Euler concluded that for such a route (Euler’s route) to exist, the following con-
ditions should be satisfied:
(i)
(ii)
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 7
In network terminology, we have the following: Given a network G(N, A) and cij ≥ 0
associated with every (i, j) ∈ A, we want to find
(15,40)
2 4
(25,30)
(45,10)
(15,30)
1 (35,50)
(45,60)
(35,50)
3 5
(25,20)
This representation stores the network as an n × m matrix that contains one row for
each node and one column for each arc. The column corresponding to arc (i, j) has
only two nonzero elements: +1 in the row corresponding to node i, and −1 in the
row corresponding to node j.
cij 25 35 15 45 15 45 25 35
uij 30 50 40 10 30 60 20 50
2. All nonzero entries are +1 or −1. Each column has exactly one +1 and one −1.
This representation stores the network as an n × n matrix. Its (i, j)th entry equals 1
if (i, j) ∈ A, and equals 0 otherwise.
1 2 3 4 5
1 0 1 1 0 0
2 0 0 0 1 0
3 0 1 0 0 0
4 0 0 1 0 1
5 0 0 1 1 0
subject to
P P
xij − xji = b(i), ∀ i ∈ N
{j:(i,j)∈A} {j:(j,i)∈A}
We wish to find a path of minimum cost from a source node s to a sink node t. Each
arc (i, j) ∈ A has an associated cost of cij .
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 11
We seek a solution that sends the maximum amount of flow from node s to node t.
We can formulate this problem as an MCNFP as follows:
Transportation Problem
Special case of MCNFP with the property that the node set is partitioned into two
sets N1 and N2 so that each node in N1 is a supply node, each node in N2 is a demand
node, and for each arc (i, j) ∈ A, we have i ∈ N1 and j ∈ N2 .
An extension is the transshipment problem where we allow transshipment nodes;
nodes that can both receive and send flow.
Circulation Problem
Assignment Problem
Examples:
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 12
1.4 OR Applications
Production Planning Problem
Consider a single item, finite horizon, discrete production planning problem. The
objective is to determine the production quantity for each period such that the as-
sociated cost is minimized. Demand in a period can be satisfied production in that
period, in previous periods (by carrying inventory), or in later periods (by backorder-
ing). Let
• Can we handle a capacity limitation for the total quantity available in a period?
• What about the constraint that there cannot be production in each of two
consecutive period?
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 14
Starting from his/her home base a salesperson wishes to visit each of several cities
exactly once and return home at the lowest possible travel cost.
An extension: Vehicle routing problem
An example: Loading jobs on a machine that requires sequence-dependent setup
times.
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 15
A steamship company has contracted to deliver perishable goods between several dif-
ferent origin destination pairs, a total of n pairs. Since the cargo is perishable, the
customers have specified precise dates when the shipments must reach their desti-
nations. The cargoes may not arrive early or late. The steamship company wants
to determine whether its fleet of k ships is sufficient. Formulate this problem as a
circulation problem.
First construct a network which contains a node for each shipment and arc from node
i to node j if it is possible to deliver shipment j after completing shipment i; that is
the start time of shipment j is no earlier than the delivery time of shipment i plus
the delivery time from the destination of shipment i to the origin of shipment j. A
directed path on this network corresponds to a feasible sequence of shipments. The
problem requires that we identify if the minimum number of directed paths that will
contain each node in the network on exactly one path is smaller than k or not.
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 16
To illustrate, consider an example with 4 shipments. The figure below provides the
necessary information.
Figure 3: (a) Shipment Characteristics (b) Shipment transit times (c) Return times
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 17
• Worst-case Analysis: Find an upper bound on the number of steps that the
algorithm can take on any problem instance as a function of the problem pa-
rameters
We will mainly consider worst-case analysis. The problem parameters are related to
size (number of nodes, number of arcs), and data (capacity,cost).
If an algorithm has an upper bound on the number of steps as a polynomial
function of the problem size, then it is called a polynomial-time algorithm. If a
polynomial-time algorithm exists to solve a problem, then it is a ‘polynomially solv-
able’ problem.
An algorithm is said to be pseudo-polynomial if its complexity function is a poly-
nomial function of the problem data.
If there cannot exist an algorithm to solve the problem in polynomial time, then
the problem is called (i) NP-hard in the ordinary sense if a pseudo-polynomial al-
gorithm exists, and (ii) NP-hard in the strong sense if there cannot be a pseudo-
polynomial algorithm either.
An algorithm is said to run in O(f (n)) time if for some numbers c and n0 , the
time taken by the algorithm is at most cf (n) for all n ≥ n0 .
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 18
• Finding all nodes in a network that can reach a specific node along directed
paths
• Topological ordering: In an acyclic network, reorder the nodes such that for
each arc (i, j) ∈ A, i < j.
algorithm search;
begin
unmark all nodes in N ;
mark node s;
pred(s):=0;
next:=1;
order(s):=next;
LIST:={s};
while LIST 6= ∅ do
begin
select a node i in LIST;
if node i is incident to an admissible arc (i, j) then
begin
mark node j;
pred(j):=i;
next:=next+1;
order(j):=next;
add node j to LIST;
end
else delete node i from LIST;
end;
end;
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 19
Breadth-first Search
If we maintain the LIST as a queue, we always select nodes from the front, and add
them to the rear. If we define the distance of node i as the minimum number of arcs
from s to i, this search first marks nodes with distance 1, then distance 2, and so on.
In the breadth-first search tree, the tree path from node s to any node i is a shortest
path (contains the fewest number of arcs).
Depth-first Search
Maintain the LIST as a stack. Select from the front, add to the front. The algorithm
creates a path as long as possible, backs up one node to continue.
Reverse Search
LIST = {t}. While examining a node, scan incoming arcs.
Topological Ordering
Select a node with zero indegree. Give it a label 1 and delete it with all the arcs
emanating from it. Continue in this manner. If at some point there is a subgraph
with no zero indegree nodes, then the graph is cyclic. The algorithm runs in O(m)
time.