week 7 Network
week 7 Network
1
Network Terminology
A B
Network Terminology (Cont’d)
A 3
1 9
Sink
5
(Demand)
Source 7 4 D
B
(Supply)
6
4 2 5 1
4
C E
Shortest Route Problem
• Find the shortest route between Source and
Sink.
• Idea is to start with the source, or origin, and find
the shortest route to each of the nodes in the
network sequentially until the destination is
reached.
A 7
2 5
2 Sink
D
4
5
Source B
7
4 1 3 1
4
C E
Algorithm for The Shortest Route
Problem
• Start with the source, or origin. Label it with zero
distance from origin. It is now called a solved node.
• Find the next nearest node: do this by
– Consider all unsolved (unlabelled) nodes that are directly
connected to a solved (labelled) node – these are the candidate
nodes
– For each candidate, calculate the distance to origin by adding
the branch distance to the labelled distance
– Find the minimum distance, and label that node with the distance
and the preceding node. This node is now called a solved node.
(if there is a tie, label both nodes.)
• Repeat until the destination becomes a solved node.
The shortest route can then be traced backwards.
Algorithm for The Shortest Route
Problem
Algorithm for The Shortest Route
Problem
Minimal Spanning Tree Problem
Minimal Spanning Tree Problem
Minimal Spanning Tree Problem
• Find the spanning tree of the shortest length
A
7
2 2
5
D Sink
4
5
Source B
7
4 1 3 1
4
C E
Minimal Spanning Tree Problem
Minimal Spanning Tree Problem
Minimal Spanning Tree Problem
Minimal Spanning Tree Problem
• All nodes are now connected, so this solution to the problem is the desired
(optimal) one.
• The total length of the links is 14 miles
Algorithm for Minimal Spanning Tree
Problem
• Start with any node (source node is OK). Label it with 0.
This is now a labelled node.
• Find the closest unlabelled node to any labelled node.
Label it with the preceding node.
• Repeat until all nodes have been labelled.
The minimal spanning tree can then be traced.
Ties may be broken arbitrarily, but multiple optimal
solutions can be identified by pursuing al ties.
Maximum Flow Problem
• Find the max flow from Source to Sink.
A 7
2 2 5 Sink
D
4
5
Source B
7
4 1 3 1
4
C E
The Augmenting Path Algorithm for the
Maximum Flow Problem
1. Identify a flow augmenting path in the residual network
(initially the original network), by checking all nodes
connected to the source node with residual capacity
along the arcs.
If no augmenting path exists, the current flow is optimal.
2. Identify the residual capacity c* of this augmenting path
by finding the minimum residual capacities along all
arcs in the path. Increase the flow in this path by c*.
3. Decrease the residual capacities on each arc in the
path by c* (if arc is in the opposite direction, increase its
residual capacity by c*). Go to step 1.
Minimum Cost Flow Problem
Transshipment nodes
Let xij be flow though arc i→j.
n n
minimize Z= c x
i =1 j =1
ij ij (cost of flow)
n n
subject to x −x
j =1
ij
j =1
ji = bi for each node i (flow conservation)