0% found this document useful (0 votes)
2 views86 pages

Network Analysis Vishal

The document covers network analysis, focusing on its applications, performance, and design issues. It explains key concepts such as graph theory, types of graphs, and algorithms for finding the shortest path, including Dijkstra's and Floyd-Warshall algorithms. Additionally, it discusses road network analysis and the importance of impedance in determining the best routes.

Uploaded by

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

Network Analysis Vishal

The document covers network analysis, focusing on its applications, performance, and design issues. It explains key concepts such as graph theory, types of graphs, and algorithms for finding the shortest path, including Dijkstra's and Floyd-Warshall algorithms. Additionally, it discusses road network analysis and the importance of impedance in determining the best routes.

Uploaded by

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

NETWORK

ANALYSIS
Learning Objective

• After Completion of this lecture , you should


be able to

• Identify applications of network Analysis,


• Explain the performance of network and network
operations.
• Demonstration an operation to find the shortest
path.
• Explain various design issues in the construction
of network.
Network analysis

• It provides the facilities of solving network problems such as


traversability, rate of flow, or capacity, using network connectivity
called Network Analysis.
• It is used for identifying the most efficient routes or paths for allocation
of services.
• Network analysis involves in finding the shortest or least-cost manner in
which to visit a location or a set of locations in a network

Road Network Analysis

• Network analysis enables you to solve problems, such as finding the


most efficient travel route, generating travel directions, finding the
closest facility, defining service areas based on travel time and distance
Basic Terminology of Network
Analysis
Network / Graph Theory
• Network = Graph
• Informally, graph is a set of nodes joined by a set of lines or arrows.
• In graph like problems, these components have natural correspondences to
problem elements.
• Graph G is an ordered triple G = (V, E, f), where
• V is the set of nodes, points and vertices.
• E is a set, whose elements are known as edges or lines
• f is a function E
• maps each elements of E. V
• to an unordered pair of vertices in V.
• Graph mathematically represented as
• V = {1,2,3,4,5,6}
• E = {(1,2),(1,5),(1,4),(2,3),(2,4),(3,6),(4,3),(5,4),(5,6)}
Types of Graph

A Graph can be divided into,


• Simple Graph
• Simple graph is the graph without multiple edges
or self loop
• Directed Graph
• Edges have delectation
• An edges is an ordered pair of nodes
• Weighted Graph
• A graph for which, each edge has an associated
weight.
• Weight can be calculated with weight function w.
Degree of Graph
• Degree of Graph for Undirected Graph
• No of edges or incident of node represents degree of Graph
• In figure, at node 5,
• Incident edges = 3
• Degree of node 5 =3
• Degree of Graph for Directed Graph
• In-degree: Number of edges entering
• Out-Degree: Number of edges leaving
• Degree = Indeg + Outdeg
• E.g. - Out-Degree at vertex 1
Outdeg(1) = 2, Indeg(1) = 0 ,
Degree = 2 at vertex/node 1
Outdeg(2) = 2, Indeg(2) = 2 ,
Degree = 4, at vertex/node 2
Some Examples of Network
Network

•A system of interconnected elements, which represent possible


routes from one location to another.
• A network is referred to as a pure network if only its topology and
connectivity are considered.
• If a network is characterised by its topology and flow
characteristics (such as capacity constraints, path choice and link
cost functions) it is referred to as a flow network.
•A transportation network is a flow network representing the
movement of people, vehicles or goods.
Transportation Network

•A transportation network can be referred to as a valued graph, or


alternatively a network.
• Directed links are referred to as arcs while undirected links as edges.
• Other useful terms with some intuitive interpretations are
• a path which is a sequence of distinct nodes connected in one direction by links;
• a cycle which is a path connected to itself at the ends;
• A tree which is a network where every node is visited once and only once.
• The relationship between the nodes and the arcs, referred to as the network
topology, can be specified by a node-arc incidence matrix.
Node Arc Incidence Matrix
• Node-arc incidence matrix is a table of
binary or ternary variables stating the
presence or absence of a relationship
between network elements.
• Here we assume that
• arcs are ordered pairs, Arc-node incidence
matrix
• no self loop
• The arc-node incidence matrix of m * n
elements
Network Datasets
• Network datasets are well suited to model transportation networks.
• A data model is an abstract representation of some real-world situation used
to organise data in a database.
• Data models typically consist of three major components
• 1. Set of objects or entity types
That forms basic building blocks of the database.
• 2. Integrity rules
• Which constrain the occurrence of entities to those which can legally appear in the
database.
• 3. Operations
That can be applied to the entities in the database.
CONT.….
Simple arc table
Arc Street Lane Other
ID Name s attributes
a High street 2
b High street 4
c High street 4
d High street 2
e River way 2
f Hill Street 2
Simple node table
Arc ID Stop Other attributes
Light
a N
b Y
c N
d Y
e N
f N
• Cont….
Arc node connectivity table
Arc Street Lan From To nodes
ID Name es nodes
a High 2 1 2
street
b High 4 2 3
street
c High 4 3 4
street
d High 2 4 5
street
Arc link table
e River 2 2 4
Arc IDway Stop Light Arc Links
f a Hill N2 3 a 6
b Street Y a, b
c N b, c, f,
d Y c, d, e
e N a, e, c
f N f
Road Network
Facilities Provide by Road Network Analysis
• The Basic facilities provide by the road network analysis are:

• Finding the best route across a city (Shortest Route),

• Finding the closest emergency vehicle or facility,

• Identifying a service area around a location,

• Servicing a set of orders with a fleet of vehicles,

• Choosing the best facilities to open or close..


New Route

• Finding a simple route between two locations or one that visits several locations,
people usually try to take the best route.

• However, "best route" can mean different things in different situations.

• The best route can be the quickest, shortest, or most scenic route, depending on the

impedance chosen.

• In consideration of finding the best route, two impedance are used, i.e. Time

impedance and Distance impedance.

• If the impedance is time, then the best route is the quickest route.

• The best route can be defined as the route that has the lowest impedance, where the
Time Impedance vs. Distance Impedance
Time Impedance Distance Impedance
• Here, time is the main constrain. • Here, distance is the main constrain.
• It gives the least time from source • It gives the least distance to from source
to destination, where distance does to destination, where time does not
not matter. matter

Travel Time- 9 Min


Travel Distance-
4.4miles

Travel Time -8 min


Travel Distance- 4.5
miles
Algorithms for Shortest Path
problem

Three basic algorithms for finding the shortest path between two nodes.
1. Dijkstra s Algorithm
 Solves only the problem with non-negative costs.
 Single Source Shortest path algorithm for all the vertices.
2. Bellman-Ford Algorithm
 Applicable to problems with arbitrary costs
3. Floyd-Warshall algorithm
 May deals with Negative-weight edges.
 Not applicable for negative-weight cycles.
• Floyd-Warshall and Bellman-Ford algorithm solve the problems on graphs that do not
have a cycle with negative cost.
Dijkstra’s Algorithm

• It gives the solution to the single-source shortest path problem in graph


theory.
• Prerequisite of Dijkstra s Algorithms
1. Both directed and undirected graphs
2. All edges must have non-negative weights
3. Graph must be connected .
Shortest path –> S-6-3-5-t
PROBLEM
Consider the following graph and find out the shortest path between an
origin (A) and the Destination (G).

Destinati
on

Origin
Cont.…

Steps used in shortest path calculation


Label starting node 0.
 List all the nodes of the graph that link directly to the starting
nodes
 Fill the column with cost value
 Find the with lowest link value and label the node with
this value
 This is the lowest cost path between the origin and this
node.
 The green link is now the permanent feature in this
network analysis
 Extend the search from this node.
 Add the node that link to this node to the list of node
that are link to the origin
 Find the node with the lowest cumulative cost and the label the node with
this value.
 In this case there are more then one nodes that has been reached in the
same cumulative cost so we label them both.
 We also suppress any redundant links that have been bypassed.
 Extend the search again.
 Add new linked nodes to the list of nodes and calculate the cumulative cost to
each.
 Find the node with the lowest cumulative cost and label the node with this value.
 We have now found the lowest cost path between the origin and destination
nodes.
Pseudocode of Dijkstra Algorithm
dist[s]  0 (distance to source vertex is zero )
for all v ∈ V-{s}
do dist[v]  ∞ (see all other distances to infinity)
S ∅ (S, the set of visited vertex initially empty )
Q V (Q, the Q initially contains all vertex )
While Q while Q≠∅ (while the queue is not empty)
do u mindistance(Q, dist) (select the element of Q with the min. distance)
S←S∪ {u} (add u to list of visited vertices)
For all v ∈ neighbors[u]
do if dist[v] > dist[u] + w(u, v) (if new shortest path found)
then d[v] ←d[u] + w(u, v) (set new value of shortest path)
(if desired, add trace back code)
return dist
Floyed-Warshall Algorithm for Shortest Path

• Use to determine all-pairs shortest path and find the length of the
shortest path between any pair of vertices in Graph(G).

• Suppose, we have directed graph G=(V,E) and the weight function


w: E ->R
• where, R is the set of real number

• Note:- G does not contain cycles of weight 0 or negative.


Negative Vs. Non-negative
Cost Cycle

Without negative cost With negative cost cycle


cycle
Formation of Weight Matrix

• We assume that the graph is represented by an n*n matrix with the


weights of the edges:


• Output:
• n*n distance matrix D = []
• where, is the distance from vertex i to j.
Intermediate vertices

• The vertices p =<>

Length of Shortest path (no intermediate vertices)

• Let be the shortest path from i to j such that all intermediate vertices
on the path (if any) are in set {1,2,……,k}.
• is the set to be
Shortest path using intermediate vertices { , , ……. }

𝑉𝑘

𝑉𝑖
𝑉𝑗

Shortest path using without intermediate vertices { ,


, ……. }
Length of Shortest Path With Intermediate
Vertices
• For the shortest path from i to j such that any intermediate
vertices in the path are chosen from the set {1,2,3……k},
• There are two possibilities:
• k is not a vertex on the path.
• The shortest path has length

• k is a intermediate vertex on the path.
• The shortest path has length

Cont…

• Combining the two cases we get

Summary

• Distance matrix

• Compute from using

• for k = 1,2,…n.
SHORTEST PATHS AND MATRİX MULTİPLİCATİON

• Example

2
3 4
1 2 3 4 5
3
1 0 3 8 ∞ -4
1
8
2 2 ∞ 0 ∞ 1 7
-5
1 3 ∞ 4 0 ∞ ∞
-4 7 4 2 ∞ -5 0 ∞
5
6
4 5 ∞ ∞ ∞ 6 0
57

Identity Matrix
SHORTEST PATHS AND MATRİX MULTİPLİCATİON

2 1 2 3 4 5
3 4
1 0 3 8 ∞ -4
1 3
2
8 2 ∞ 0 ∞ 1 7
-5
1 3 ∞ 4 0 ∞ ∞
-4 7 4 2 ∞ -5 0 ∞
5 4
6 5 ∞ ∞ ∞ 6 0

D1= D0W

58
SHORTEST PATHS AND MATRİX MULTİPLİCATİON

2 1 2 3 4 5
3 4
1 0 3 8 2 -4
1 3
2
8 2 3 0 -4 1 7
-5
1 3 ∞ 4 0 5 11
7
-4 4 2 -1 -5 0 -2
5 4
6
5 8 ∞ 1 6 0
D2= D1W

59
SHORTEST PATHS AND MATRİX MULTİPLİCATİON

2 1 2 3 4 5
3 4
1 0 3 -3 2 -4
3
1
2
8 2 3 0 -4 1 -1
-5
1 3 7 4 0 5 11
-4 7 4 2 -1 -5 0 -2
5 4
6 5 8 5 1 6 0

D3= D2W

60
SHORTEST PATHS AND MATRİX MULTİPLİCATİON

1 2 3 4 5
2
3 4 1 0 1 -3 2 -4
1 3 2 3 0 -4 1 -1
8
2
-5 3 7 4 0 5 3
1

-4 7 4 2 -1 -5 0 -2
5
6
4 5 8 5 1 6 0
D4= D3W

61
Bellman-Ford
Algorithm
• Published by Richard E. Bellman and Lester Ford, Jr. in 1958 in their
publication “On a Routing Problem”

• Use relaxation to find single source shortest paths on directed graphs that may
contain negative weight edges.

• It will also detect Negative weight cycle(such that there is no solution)

• Find the shortest paths from a source to all possible destinations using only one
link.

• Algorithm will find all the paths correctly where, we repeat that N-1 times,
where N is the number of vertices (|V| = N)!
Steps For Determining The Shortest
Path
Initialize d's, π's, and set s.d = 0 ⇒ O(V)
Loop |V|-1 times through all edges checking the relaxation condition to
Compute minimum distances ⇒ (|V|-1) O(E) = O(VE)
Loop through all edges checking for negative weight cycles which
occurs if any of the relaxation conditions fail ⇒ O(E)
The solutions utilize the concept of edge relaxation which is a test
todetermine whether going through edge (u,v) reduces the distance to v
 And if so update v.π and v.d. This is accomplished using the condition
Bellman-ford Algorithm
BELLMAN-FORD(G,w,s)
INITIALIZE-SINGLE-SOURCE(G,s)
for i = 1 to |G.V|-1
for each edge (u,v) ∈ G.E
RELAX(u,v,w)
for each edge (u,v) ∈ G.E
if v.d > u.d + w(u,v)
return FALSE
return TRUE
• INITIALIZE-SINGLE-SOURCE(G,s)
• for each vertex v ∈ G.V

v.d = ∞
RELAX(u,v,w)
v.pi = NIL if v.d > u.d + w(u,v)
v.d = u.d + w(u,v)
s.d = 0
v.pi = u
Example
Given the following directed graph

(1,3)=6
(1,4)=3
(2,1)=3
(3,4)=2
(4,2)=1
(4,3)=1
(5,2)=4
(5,4)=2
Cont…

 Using vertex 5 as the source (Setting ist


distance to 0),
 Initialize all the other distance to infinite
(1,3)=6
(1,4)=3
(2,1)=3
(3,4)=2
(4,2)=1
(4,3)=1
(5,2)=4
(5,4)=2
1 2 3 4 5
D Infi Infi Infi Infi 0
Pi / / / / /
Cont…

Iteration 1 : Edges (u5,u2) and (u5,u4) relax updating the


distances to 2 and 4

(1,3)=6
(1,4)=3
(2,1)=3
(3,4)=2
(4,2)=1
(4,3)=1
(5,2)=4
(5,4)=2
1 2 3 4 5
D ∞ 4 ∞ 2 0

п / 5 / 5 /
Cont…

Iteration 2: Edges (u2,u1), (u4,u2) and (u4,u3) relax updating the


distances to 1, 2, and 4 respectively.
Note edge (u4,u2) finds a shorter path to vertex 2 by going
through vertex 4 (1,3)=6
(1,4)=3
(2,1)=3
(3,4)=2
(4,2)=1
(4,3)=1
(5,2)=4
(5,4)=2
1 2 3 4 5
D 7 3 3 2 0
п 2 4 4 5 /
Cont…

Iteration 3: Edge (u2,u1) relaxes (since a shorter path to


vertex 2 was found in the previous iteration) updating the
distance to 1
(1,3)=6
(1,4)=3
(2,1)=3
(3,4)=2
(4,2)=1
(4,3)=1
(5,2)=4
(5,4)=2

1 2 3 4 5
D 6 3 3 2 0
п 2 4 4 5 /
Cont…

Iteration 4: No edges relax

(1,3)=6
(1,4)=3
(2,1)=3
(3,4)=2
(4,2)=1
(4,3)=1
(5,2)=4
(5,4)=2

1 2 3 4 5
D 6 3 3 2 0
п 2 4 4 5 /
Cont…

The final shortest paths from vertex 5 with


corresponding distances is

V 1 2 3 4 5
D 6 3 3 2 0
п 2 4 4 5 /
Negative cycle checks

• We now check the relaxation condition one additional time for each
edge. If any of the checks pass then there exists a negative weight
cycle in the graph.

• v3.d > u1.d + w(1,3) ⇒ 4 ≯ 6 + 6 = 12 ✓


• v4.d > u1.d + w(1,4) ⇒ 2 ≯ 6 + 3 = 9 ✓
• v1.d > u2.d + w(2,1) ⇒ 6 ≯ 3 + 3 = 6 ✓
• v4.d > u3.d + w(3,4) ⇒ 2 ≯ 3 + 2 = 5 ✓
• v2.d > u4.d + w(4,2) ⇒ 3 ≯ 2 + 1 = 3 ✓ Note: for the edges on the shortest
paths the relaxation criteria gives
• v3.d > u4.d + w(4,3) ⇒ 3 ≯ 2 + 1 = 3 ✓ equalities.

• v2.d > u5.d + w(5,2) ⇒ 3 ≯ 0 + 4 = 4 ✓


• v4.d > u5.d + w(5,4) ⇒ 2 ≯ 0 + 2 = 2 ✓
Cont…

• Additionally, the path to any reachable vertex can be found by


starting at the vertex and following the π's back to the source.

• For example, starting at vertex 1, u1.π = 2, u2.π = 4, u4.π = 5 ⇒


the shortest path to vertex 1 is {5,4,2,1}.
Negative weight cycle
 A given Directed Connected graph
G with edge weights w(e) on the
edges e.
 A Negative cycle in G is a cycle

- --……………. -
In which,
w() + w) +…………….w( < 0
EXAMPLE
All the nodes have been covered,
we run one more step
Shortest path shown with the help of coloured
arrow with corresponding weight
THE END

You might also like