Module-03 Networking
Module-03 Networking
Module-3
J Uma mahesh
Network Optimization Models
Network representations also are widely used for problems in such
diverse areas as production, distribution, project planning, facilities
location, resource management, supply chain management and
financial planning— to name just a few examples.
Many network optimization models actually are special types of
linear programming problems.
we shall introduce you to five important kinds of network problems
and some basic ideas of how to solve them (without delving into
issues of data structures that are so vital to successful large-scale
implementations).
Types of network problems
EXAMPLE
SEERVADA PARK has recently been set aside for a limited amount of sightseeing and
backpack hiking. Cars are not allowed into the park, but there is a narrow, winding road
system for trams and for jeeps driven by the park rangers. This road system is shown
(without the curves) in Fig. 10.1, where location O is the entrance into the park; other
letters designate the locations of ranger stations (and other limited facilities). The
numbers give the distances of these winding roads in miles.
THE TERMINOLOGY OF NETWORKS
A network consists of a set of points and a set of lines connecting
certain pairs of the points. The points are called nodes (or vertices);
e.g., the network in Fig. 10.1 has seven nodes designated by the seven
circles. The lines are called arcs (or links or edges or branches); e.g., the
network in Fig. 10.1 has 12 arcs corresponding to the 12 roads in the
road system. Arcs are labeled by naming the nodes at either end; for
example, AB is the arc between nodes A and B in Fig. 10.1
The arcs of a network may have a flow of some type through them, e.g.,
the flow of
trams on the roads of Seervada Park in Sec. 10.1. Table 10.1 gives several
examples of
flow in typical networks. If flow through an arc is allowed in only one
direction (e.g., a
one-way street), the arc is said to be a directed arc. The direction is
indicated by adding
an arrowhead at the end of the line representing the arc. When a directed
arc is labeled by
listing two nodes it connects, the from node always is given before the to
node; e.g., an arc
that is directed from node A to node B must be labeled as AB rather than
BA. Alternatively,
this arc may be labeled as A B.
If flow through an arc is allowed in either direction (e.g., a pipeline that can
be used
to pump fluid in either direction), the arc is said to be an undirected arc.
To help you
Algorithms for finding shortest route
(Network problems)
• There are several algorithms for solving the shortest route problem, including:
1.Dijkstra's Algorithm: a graph search algorithm that finds the shortest path from a
source node to all other nodes in a weighted graph.
2.Bellman-Ford Algorithm: an algorithm that finds the shortest path in a weighted graph
with negative edge weights.
3.A* Algorithm: a heuristic search algorithm that combines Dijkstra's algorithm with a
best-first search.
4.Floyd-Warshall Algorithm: an algorithm that finds the shortest path between all pairs of
nodes in a weighted graph.
5.Johnson Algorithm: an algorithm that finds the shortest path between all pairs of nodes
in a weighted graph, with a time complexity of O(n^2 log n).
6.Viterbi Algorithm: a dynamic programming algorithm used for finding the most likely
sequence of hidden states in a Markov model. It can also be used to find the shortest
path in a weighted graph.
• All of these algorithms have their own strengths and weaknesses, and the choice of
algorithm depends on the specific problem and constraints.
Initial Distance
matrix from node
1 to node 4
Minimum Spanning Tree
• What is a Spanning Tree?
Links:
https://www.geeksforgeeks.org/prims-minimum-spanning-tree-mst-greedy-algo-5/
07-09-23 module-03: Prim Alogorithm
O vertex is selected as starting vertex
Step 2: All the edges connecting the incomplete MST and other vertices are the edges {0, 1}
and {0, 7}. Between these two the edge with minimum weight is {0, 1}. So include the edge
and vertex 1 in the MST.
Maximum flow problem Example
Consider a network of pipelines that transports crude oil from oil wells
to refineries. Intermediate booster and pumping stations are installed
at appropriate design distances to move the crude in the network. Each
pipe segment has a finite discharge rate (or capacity) of crude flow. A
pipe segment may be uni- or bidirectional, depending on its design.
Figure 6.18 demonstrates a typical pipeline network. The goal is to
determine the maximum flow capacity of the network.
Figure 6.18
A cut defines a set of arcs whose removal from the network disrupts flow
between the source and sink nodes. The cut capacity equals the sum of the
capacities of its set of arcs. Among all possible cuts in the network, the cut with
the smallest capacity is the bottleneck that determines the maximum flow in the
network.
PM – class 19-09-23
After backward arc calculations
Final solution
Solve this
problem
using ford
Fulkerson’s
algorithm.
Find the max
flow of this
network
Ford-Fulkerson algorithm
The Ford-Fulkerson algorithm is a popular method for finding the maximum flow in a flow
network. It's a flexible algorithm that can be implemented using various path-finding
algorithms, such as breadth-first search (BFS) or depth-first search (DFS), as you
mentioned. Here's a more detailed explanation of the algorithm steps:
1.Initialization: Start with an initial flow of 0 for all edges in the network.
2.While there exists an augmenting path from the source to the sink:
•An augmenting path is a path from the source node to the sink node in the residual
graph (the graph that represents available capacity after the initial flow is
subtracted). This path should have at least one edge with positive residual capacity.
3.Find an augmenting path:
•You can use a path-finding algorithm like BFS or DFS to find an augmenting path in
the residual graph from the source to the sink.
4.Determine the amount of flow that can be sent along the augmenting path:
•The amount of flow that can be sent along the augmenting path is limited by the
edge with the minimum residual capacity among the edges in the path. This value is
called the bottleneck capacity.
Ford-Fulkerson algorithm
5.Increase the flow along the augmenting path by the determined amount:
•Add the bottleneck capacity to the flow along each edge in the augmenting path. This increases the flow
from the source to the sink.
6.Update the residual graph:
•After updating the flow, update the residual capacities in the residual graph. For forward edges, subtract
the flow from their capacity, and for backward edges (to allow flow reversal), add the flow to their capacity.
7.Repeat steps 2-6:
•Keep finding augmenting paths and increasing the flow along those paths until no more augmenting paths
can be found. This is when there are no paths from the source to the sink in the residual graph with positive
residual capacity.
8.Return the maximum flow:
•Once there are no more augmenting paths, you've found the maximum flow in the network. Sum up the
flow values leaving the source node (or entering the sink node), and that's your maximum flow.
The Ford-Fulkerson algorithm may not always terminate in a finite number of iterations if there are edge
capacities with fractional values or if there are augmenting paths with zero capacity. To ensure termination, you
can use an augmenting path-finding algorithm that guarantees termination, such as the Edmonds-Karp
algorithm, which is based on BFS.
Also, be aware that the Ford-Fulkerson algorithm may not work correctly if capacities have real numbers, as it
assumes integer capacities. To handle real-number capacities, you might need to use techniques like scaling or
network simplex methods.