Problem Solving with Networks - PowerPoint PPT Presentation

problem solving with networks n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Problem Solving with Networks PowerPoint Presentation
Download Presentation
Problem Solving with Networks

play fullscreen
1 / 25
Problem Solving with Networks
73 Views
Download Presentation
vita
Download Presentation

Problem Solving with Networks

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Problem Solving with Networks 21/09/2011 Jamie Sneddon j.sneddon@auckland.ac.nz

  2. Networks, graphs • A graph is collection of points with lines between them • A network is a graph with positive numbers assigned to its edges as weights

  3. Distances in miles between some US cities

  4. Distances in miles between some US cities Rochester NY Buffalo NY Detroit MI Toledo OH Cleveland OH Scranton PA New YorkNY Harrisburg PA PittsburghPA Columbus OH Philadelphia PA Washington DC

  5. Distances in miles between NE state US cities Rochester NY Buffalo NY Detroit MI Toledo OH Cleveland OH Scranton PA New YorkNY Harrisburg PA PittsburghPA Columbus OH Philadelphia PA Washington DC

  6. Distances in miles between NE state US cities Rochester NY Buffalo NY Detroit MI Toledo OH Cleveland OH Scranton PA New YorkNY Harrisburg PA PittsburghPA Columbus OH Philadelphia PA Washington DC

  7. Distances in miles between NE state US cities 73 255 217 190 61 117 134 121 144 112 142 125 204 95 185 107 246 121 141

  8. Distances in miles between NE state US cities Rochester NY Buffalo NY 73 Detroit MI 255 Toledo OH 217 190 61 117 Cleveland OH Scranton PA New YorkNY 134 121 144 112 142 Harrisburg PA 125 204 95 185 107 PittsburghPA Columbus OH 246 Philadelphia PA 121 141 Washington DC

  9. Distances in miles between NE state US cities R B 73 D 255 217 190 61 S T Cl 117 N 134 121 Pi 144 112 142 H 125 204 95 185 107 Co Ph 246 121 141 W

  10. Spanning Tree with edge deletion R B 73 D 255 217 190 61 S T Cl 117 N 134 121 Pi 144 112 142 H 125 204 95 185 107 Co Ph 246 121 141 W

  11. Spanning Tree with edge inclusion (1) R B 73 D 255 217 190 61 S T Cl 117 N 134 121 Pi 144 112 142 H 125 204 95 185 107 Co Ph 246 121 141 W

  12. Spanning Tree with edge inclusion (2) R B 73 D 255 217 190 61 S T Cl 117 N 134 121 Pi 144 112 142 H 125 204 95 185 107 Co Ph 246 121 141 W Total weight = 1356 miles

  13. Problems in networks • (0) Are all the nodes connected? • (1) What is the lowest weight (smallest) tree which connects all the nodes? • (2) What is the shortest distance from A to B? • (3) Can every edge be used exactly once? • (4) Can every node be visited exactly once? • (5) What is the shortest way to visit every node exactly once?

  14. (0) Connectedness • It’s usually easy to tell if a real-world network is connected or not. Starting at an arbitrary node, if we list that node’s neighbours, then their neighbours, then theirs, we might eventually visit all the nodes. • [ACTIVITY] • If we don’t, it’s not c0nnected.

  15. (1) Spanning Tree • A minimum weight spanning tree is a sub-graph without cycles which connects all the nodes. • A tree with n nodes has n-1 edges. • Sometimes it’s easier to add edges, sometimes remove them.

  16. (2) Shortest Path • Starting at a particular node A, what is the shortest path to another vertex B (or to all other vertices). • [ACTIVITY 2]

  17. (3) Traversability • Is it possible to start at a node A and follow a route through the network which uses every edge exactly once? • If so, does the path return to A, or end elsewhere? • Easily characterised with node parity (even/odd)

  18. (4) Visiting nodes • Is it possible to start at a node A and follow a route through the network visits every NODE exactly once? • If so, does the path return to A, or end elsewhere? • Called Hamiltonian: no characterisation, and hard to find

  19. (5) Travelling Salesman • What is the shortest Hamiltonian cycle/path? • This is harder still!TSP (Travelling Salesman Problem) is the definitive “hard” problem of computational mathematics

  20. Real World / Mathematical World • Networks don’t always model the real world perfectly – what could go wrong? • One way edges • Different weight directions on edges • Variable data (time of day, day of week) • Roads branching outside towns

  21. Questions beyond the procedural • Why did you use this algorithm? • Compare two algorithms • edge inclusion vs edge deletion • How could the network be changed to give (or remove) a property • What does this mean in relation to the given problem

  22. How does

  23. Where to add connections? • Where in the network should edges be added/removed so that it is traversable?

  24. Optional nodes • What if we want to allow the possibility of a node outside a town? • Construct two spanning trees: with/without 5 5 2.5 4 3 3 2.5 1 5 2

  25. For more: Wikipedia! • Prim’s Algorithm (connected sub-tree) • Kruskal’s Algorithm (partial trees) • Reverse-Delete Algorithm (remove edges) • Dijkstra’s Algorithm • Euler Path – Fleury’s Algorithm • Jamie Sneddon j.sneddon@auckland.ac.nz