Programming for Geographical Information Analysis: Advanced Skills - PowerPoint PPT Presentation

About This Presentation
Title:

Programming for Geographical Information Analysis: Advanced Skills

Description:

Programming for Geographical Information Analysis: Advanced Skills Online mini-lecture: Introduction to Networks Dr Andy Evans – PowerPoint PPT presentation

Number of Views:96
Avg rating:3.0/5.0
Slides: 27
Provided by: Andrew1736
Category:

less

Transcript and Presenter's Notes

Title: Programming for Geographical Information Analysis: Advanced Skills


1
Programming for Geographical Information
AnalysisAdvanced Skills
  • Online mini-lecture Introduction to Networks
  • Dr Andy Evans

2
This lecture
  • Introduction.
  • Graph theory.
  • Types of Networks.
  • Path analysis.
  • Flow analysis.

3
Networks?
  • Vehicle / Distribution
  • Motorways, rail, electricity grid, water, nerves,
    circuits.
  • Socio-economic
  • Trade, politics, friendship.
  • Spatial-temporal
  • Timetables, zonal maps, chemical structures.
  • Almost any set of complex relationships between
    variables can be represented as a network in
    variable space.

4
Graph Theory
  • The study of networks as graphs.
  • How do we efficiently move around networks?
  • How do networks break down?
  • Can we add links to improve networks?
  • How do things spread around networks?

5
What is a graph?
  • Combination of (potentially disconnected)
    Vertices and Edges.
  • Can be Directional (sometimes called digraphs)

6
What is a graph?
  • Vertices are the points on a network.
  • Edges are the relationships.
  • The degree of a vertex is the number of edges it
    has connected to it.

7
Representing networks
  • Note that it is only the connections that matter,
    not how theyre drawn.
  • E.g. contiguousness in maps.

1
2
3
4
5
6
1
1
2
3
2
3
4
4
5
5
6
6
8
Types of graph
Complete each vertex is connected to all the
others. Regular each vertex has the same
number of edges. Simple no loops or multiple
paths.
9
Walks, Trails and Paths
  • A Walk any sequence of adjacent edges.
  • A Trail any sequence of unrepeated adjacent
    edges.
  • A Path any sequence of adjacent edges that dont
    visit the same vertex more than once.

A trail, but not a path.
A path that ends where it begins is called a
Cycle.
10
Eulerian networks
  • A graph is Eulerian if there is a trail
    containing every edge in a graph.
  • Euler solved the Königsberg Bridges problem can
    you cross all the bridges and return to your
    starting point, crossing each once and once only

A
D
B
C
11
Eulerian networks
  • A graph will contain a cycle if each vertex has a
    degree of gt2.
  • A connected graph is Eulerian if, and only if,
    the degree of each vertex is even.
  • A semi-Eulerian network is the same but doesnt
    end up at its start.
  • A connected graph is semi-Eulerian when only two
    of its vertices are odd.
  • Uses
  • Designing one-way systems.
  • Designing diversions / flow alterations.

12
Fleurys Algorithm
  • How to construct a Eulerian trail in a Eulerian
    graph.
  • Start with any vertex, and travel through the
    edges, following these rules
  • As you go through each edge, mark it as taboo.
  • If you create isolated vertices, mark them as
    taboo.
  • Only use a bridge as a last resort.
  • A bridge is an edge connecting two otherwise
    disconnected graphs

13
Hamiltonian networks
  • A graph is Hamiltonian if theres a path taking
    in every vertex once only, that ends where it
    began.
  • A graph is semi-Hamiltonian if theres a trail
    taking in every vertex once only that doesnt end
    where it began.
  • Diracs Theorem
  • A simple graph with n vertices (more than two) is
    Hamiltonian if the degree of each vertex is
    greater than n/2.
  • Note that there may be more Hamiltonian
    situations.

14
Weighted graphs
  • So far weve only been interested in connections,
    but we can add strength, capacity, or length of
    connections.
  • This gives much more realistic networks, and
    allows us to study real path optimisation
    problems.

3
4
1
1
3
Path length 5
2
3
15
Path optimisation problems
  • Three major problems
  • Shortest Path Problem
  • What is the shortest path between two points?
  • Chinese Postman Problem
  • What is the shortest way around a network back to
    the start taking in each edge (imagining the
    edges to be roads of houses)?
  • Travelling Salesman Problem
  • What is the shortest way around a network back to
    the start taking in each vertex (imagining each
    to be a city)?

16
Shortest Path Problem
  • Find the shortest path across a weighted graph.

17
Shortest Path Problem algorithm
  • Move from A to B, treating all the vertices at
    each distance from the start in turn.
  • Attribute the value of the shortest path to each
    vertex to that vertex, then reassess each of its
    neighbours to see if the path is now shorter to
    them.
  • Continue until at the destination and follow back
    shortest path.

9
8
9
5
9
5
3
3
14
3
A
0
A
0
2
2
1
1
2
2
18
Chinese Postman Problem
  • Suggested by Mei-Ku Kwan
  • Find the shortest walk taking in all the weighted
    edges and coming back to the start.
  • If the graph is Eulerian we can use Fleurys
    method.
  • If not we find a semi-Eulerian trail using
    Fleurys to take in all the edges.
  • We then use the Shortest Path algorithm to find
    our way back to the start.

19
Travelling Salesman Problem
  • Find the shortest weighted path needed to visit a
    number of cities once (i.e. the shortest
    Hamiltonian path).
  • No efficient accurate algorithm.
  • Could calculate all the possible Hamiltonians and
    pick the shortest.
  • However, for 20 cities on a Hamiltonian graph,
    there are about 6 x 1016 such possible paths.
  • One solution is to use a Minimum Connector.

20
The Minimum Connector Problem
  • Work out the smallest sub-network to connect a
    set of vertices on a weighted network a
    spanning tree.
  • Choose the smallest weighted edge.
  • Continue picking the next smallest connected
    edges but not using edges that form cycles with
    the ones already picked.

3
3
3
2
2
2
1
6
1
6
1
6
5
5
5
21
The Travelling Salesman revisited
  • If we remove a vertex from a Hamiltonian path, we
    end up with a spanning tree.
  • To get an good approximation for the Travelling
    Salesman path, we
  • Remove a vertex from the graph, and its
    associated edges.
  • Form the minimum connector for the rest of the
    graph.
  • Add in the vertex and the two of its edges with
    the minimum weights.
  • This will give us a semi-Hamiltonian which the
    solution cant be better than, and which the
    solution will be close to.
  • Alternatively use AI to search the solution space.

22
Network flows strong connection
  • Strongly connected graphs are those digraphs
    where every vertex can be reach from every other.
  • A graph can be made into a strongly connected one
    if each edge is in a cycle.
  • I.e. you cant make a purely one-way system in a
    town split by a single bridge.

23
Maximum Flow Minimum Cut
  • Given each part of a network has a capacity, what
    is the maximum capacity of the network?
  • It equals the minimum capacity cut of the
    graph.
  • A cut is a set of edges which a flow must pass
    through one of.

24
Other things Graph Theory can help with
  • Finding the distribution of flow in
    interconnected networks with resistances and
    inputs/outputs.
  • Calculating whether graph lines, e.g. railways,
    need to cross.
  • Calculating the number of rearrangements possible
    between vertices on a graph.
  • The maximum number of different paths between two
    places.
  • Timetabling (using rooms and people as
    components).
  • How many colours it takes to colour a zonal map.
  • How long it takes to do a number of parallel
    tasks.
  • Magic squares.
  • Arranged marriages.

25
Summary
  • Graph theory encapsulates the mathematics of
    networks.
  • Eulerian graphs are those where you can visit all
    the edges one and end up at the start.
  • Hamiltonian graphs are those where you can visit
    all the vertices once and end up at the start.
  • The rules for these graphs help us design network
    systems.

26
Summary
  • By giving weights to edges we can model real
    dynamic systems.
  • We can find out optimal paths.
  • We can work out transport loads.
Write a Comment
User Comments (0)
About PowerShow.com