0% found this document useful (0 votes)
67 views

L3 - Network Algorithms: NGEN06 (TEK230) - Algorithms in Geographical Information Systems

This document discusses network algorithms in geographic information systems. It focuses on algorithms for finding the shortest path between nodes in a network, including Dijkstra's algorithm. Dijkstra's algorithm uses an adjacency matrix and state matrix to iteratively find and update the shortest path between a starting node and all other nodes until the end node is reached. Other topics covered include general network issues, properties of shortest path algorithms, and other network problems like minimum spanning trees and the traveling salesman problem.

Uploaded by

divyangkapadia
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views

L3 - Network Algorithms: NGEN06 (TEK230) - Algorithms in Geographical Information Systems

This document discusses network algorithms in geographic information systems. It focuses on algorithms for finding the shortest path between nodes in a network, including Dijkstra's algorithm. Dijkstra's algorithm uses an adjacency matrix and state matrix to iteratively find and update the shortest path between a starting node and all other nodes until the end node is reached. Other topics covered include general network issues, properties of shortest path algorithms, and other network problems like minimum spanning trees and the traveling salesman problem.

Uploaded by

divyangkapadia
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

L3-Network Algorithms

L3 Network Algorithms
NGEN06(TEK230)
Algorithms in Geographical Information Systems
L3-Network Algorithms
Background
Networks are essential in GIS.
By using the distances between nodes in a network
we can derive the shortest path, minimum number
of nodes to pass, and other interesting quantities in
GIS.
Shortest path-> Dijkstras algorithm
L3-Network Algorithms
Aim
Understand how an algorithm can use geographic
information stored in a network.
Get knowledge about the shortest path problem and
Dijkstras algorithm.
L3-Network Algorithms
Content
1. General issues of networks
2. Dijkstras algorithm
3. Other shortest path algorithms
4. Neighbourhood graphs and clustering
5. Traveling salesman problem.
L3-Network Algorithms
General issues of networks
A network or graph has 2 main components:
Nodes
Edges
Many analysis in networks only consider the nodes and
the edges (distances between nodes).
Information about the geometric location of the
nodes is uninteresting.
L3-Network Algorithms
General issues of networks
0 4 2 - D
4 0 3 1 C
2 3 0 2 B
- 1 2 0 A
D C B A
Networks can be stored in matrixes.
In most cases relational databases or lists and trees are more
suitable storage structures.
- implies that the nodes are not connected by any edge
L3-Network Algorithms
Shortest path
The path between two nodes that is shorter than
all the other possible paths.
In the shortest path problem we are not only
restricted to Euclidean distances, but all the kind
of distances are of interest.
Dijkstras algorithm is one of the most well-
known shortest path algorithms.
L3-Network Algorithms
Dijkstras algorithm
Example of finding the shortest path between nodes A
and D.
We need 2 matrixes:
Adjacency matrix
State matrix (dynamic)
0 4 2 - D
4 0 3 1 C
2 3 0 2 B
- 1 2 0 A
D C B A
No - D
No A 1 C
No A 2 B
Yes A 0 A
Visited Path Distance Node
Initialized state matrix
L3-Network Algorithms
Dijkstras algorithm
State matrix
Distance keeps track of the current shortes distance from the
starting node to this node.
Path stores the previous node along the shortes path (found
so far) to this node.
Visited describes is the node has been visited in the
computations of the shortest path.
Initialization of the state matrix:
The start node is marked as visited.
All the nodes that can be reached from the start node have been updated in the
columns distance and path.
Distance values are set to the distances between the start node and the
respective node (use the adjacency matrix).
Path values are set to the start node (the starting node is the current shortest
path to this particular node)
If there is no known path to some nodes, their distance is set to infinity and their
path value are undefined.
L3-Network Algorithms
Dijkstras algorithm
0. Initialize the state matrix.
1. Find the node which has the shortest distance and is not yet
visited. Denote this as the current node.
2. Mark the current node as visited.
Stop Criteria: End node visited?
3. For each node (m) that is not yet visited do:
If the node m and the current node has a common edge
AND
the sum of the distances for the start node to current node
and from current node to node m (found in the adjacency
matrix) is shorter than the current distance from the starting
node to node m (stored in the state matrix)
DO
update the distance and the path for node m.
4. Proceed from (1) again until the end node is visited.
L3-Network Algorithms
Result of the shortest path algorithm
Distance from start to end node
Path
Yes B 4 D
Yes A 1 C
Yes A 2 B
Yes - 0 A
Visited Path Distance Node
L3-Network Algorithms
Dijkstras algorithm
This algorithm does
not search along a
possible path
direction (depth-first)
but rather in all
directions (breadth-
first).
L3-Network Algorithms
Does Dijkstras algorithm always give a
correct answer?
Conditions for a metric:
1. d(p,q)>=0, d(p,q)=0 p=q
2. d(p,q)=d(q,p) (symmetry)
3. d(p,q)<=d(p,r)+d(r,q) (triangle inequality)
L3-Network Algorithms
Other shortest path algorithms
Heuristic 1 Direction limitation
A* algorithm
Heuristic 2 Hierarchical algorithm
L3-Network Algorithms
Neighbourhood graphs and Clustering
Minimum Spanning Tree
(MST)
1. No isolated node
2.
Threshold distance
L3-Network Algorithms
Traveling salesman problem
1. Begin and end in the
same node.
2. Visit all nodes.
3. Minimize total length of
the route.
NP-complete

You might also like