Presentation is loading. Please wait.

Presentation is loading. Please wait.

Route Inspection Which of these can be drawn without taking your pencil off the paper and without going over the same line twice? If we introduce a vertex.

Similar presentations


Presentation on theme: "Route Inspection Which of these can be drawn without taking your pencil off the paper and without going over the same line twice? If we introduce a vertex."— Presentation transcript:

1 Route Inspection Which of these can be drawn without taking your pencil off the paper and without going over the same line twice? If we introduce a vertex where two lines meet and make the lines edges, then we can model these problems as graphs. If we can find a path that goes over all the edges of the graph without repeating an edge then the graph is said to be traversable.

2 Route Inspection Whether or not a graph is traversable depends on the number of edges that meet at the vertices. The number of edges that meet at a vertex is called the degree of that vertex. Odd Degree 3 Degree 2 Even Even Degree 2 Degree 3 Odd An odd vertex is one with an odd degree. An even vertex is one with an even degree.

3 Route Inspection A graph with only even vertices is traversable and we can start and finish at the same vertex. Such a graph is called Eulerian. All vertices even – Eulerian graph.

4 Route Inspection A graph with exactly 2 odd vertices is traversable as long as we start on one of the odd vertices and finish at the other one. Such a graph is called Semi-Eulerian. 2 odd vertices – Semi-Eulerian All vertices even – Eulerian graph.

5 Route Inspection A graph with more than two odd vertices is not traversable. 4 odd vertices – not traversable 2 odd vertices – Semi-Eulerian All vertices even – Eulerian graph.

6 Route Inspection Which type of graph is the one on the far right?
4 odd vertices – not traversable 2 odd vertices – Semi-Eulerian Two odd vertices - Semi-Eulerian All vertices even – Eulerian graph.

7 Route Inspection G B C E D F A 5 7 8 3 4 2 6
Consider now a network with weights associated with the edges. The route inspection problem is to find a path through the network that includes every edge at least once and has the minimum total weight. Postman Pat has to deliver along each of the roads in the network below. What is his minimum total distance? G B C E D F A 5 7 8 3 4 2 6

8 Route Inspection 3 A 8 E B 5 4 7 G D 3 6 4 2 5 7 6 C F
All the vertices are even – the network is Eulerian – so any route that traverses the graph will suffice. An example of one such path out of the many is: AEBCDFEDBGCFA 3 A 8 E B 5 4 7 G D 3 6 4 2 5 7 6 C F The minimum total distance is just the sum of the edges. = 60

9 Route Inspection 3 A 8 E B 5 4 7 12 G D 3 6 4 2 5 7 6 C F
Another road is added to Pat’s round. There are now 2 odd nodes, A and D, so the graph is Semi-Eulerian. The graph is still traversable if we start at one of the odd nodes and finish at the other one. 3 A 8 E B 5 4 7 12 G D 3 6 4 2 5 7 6 C F

10 Route Inspection G B C E D F A 5 7 8 3 4 2 6 12
What if Pat needs to start and finish at the same place? To start and finish at A he will need to get back from D to A at the end. What is the shortest way of doing this? We could use Dijkstra’s shortest path algorithm for this but for this small example we can see it is along DEA, adding 10 to the total length. G B C E D F A 5 7 8 3 4 2 6 12

11 Route Inspection 3 A 8 E B 5 4 7 12 G D 3 6 4 2 5 7 6 C F
So by repeating the edges DE and EA we can start at A, cover every street and get back to A. The total distance = sum of all the edges + repeated edges = 72 + (3 + 7) = 82 3 A 8 E B 5 4 7 12 G D 3 6 4 2 5 7 6 C F One of the many alternative routes that give this total is: AEBGCFEDBCDFGDEA

12 Route Inspection 3 A 8 E B 5 4 7 12 G D 3 6 4 2 5 7 6 C F 6
To complete his rounds and finish at the place he started, he will have to repeat one of the following pairs of paths G – F and D – A G – D and F – A G – A and D – F Which of these pairings adds the least amount of extra distance? Suppose now another road is added, FG. We now have four odd vertices A, D, F and G. We have to consider all the ways of pairing up these four vertices. 3 A 8 E B 5 4 7 12 G D 3 6 4 2 5 7 6 C F 6

13 Route Inspection 3 A 8 E B 5 4 7 12 G D 3 6 4 2 5 7 6 C F 6
To complete his rounds and finish at the place he started, he will have to repeat one of the following pairs of paths G – F and D – A G – D and F – A G – A and D – F Which of these pairings adds the least amount of extra distance? To complete his rounds and finish at the place he started, he will have to repeat one of the following pairs of paths G – F and D – A = (7 + 3) = 16 G – D and F – A G – A and D – F Which of these pairings adds the least amount of extra distance? 3 A 8 E B 5 4 7 12 G D 3 6 4 2 5 7 6 C F 6

14 Route Inspection 3 A 8 E B 5 4 7 12 G D 3 6 4 2 5 7 6 C F 6
To complete his rounds and finish at the place he started, he will have to repeat one of the following pairs of paths G – F and D – A = (7 + 3) = 16 G – D and F – A G – A and D – F Which of these pairings adds the least amount of extra distance? To complete his rounds and finish at the place he started, he will have to repeat one of the following pairs of paths G – F and D – A = (7 + 3) = 16 G – D and F – A = (5 + 4) + 6 = 15 G – A and D – F Which of these pairings adds the least amount of extra distance? 3 A 8 E B 5 4 7 12 G D 3 6 4 2 5 7 6 C F 6

15 Route Inspection 3 A 8 E B 5 4 7 12 G D 3 6 4 2 5 7 6 C F 6
To complete his rounds and finish at the place he started, he will have to repeat one of the following pairs of paths G – F and D – A = (7 + 3) = 16 G – D and F – A = (5 + 4) + 6 = 15 G – A and D – F Which of these pairings adds the least amount of extra distance? To complete his rounds and finish at the place he started, he will have to repeat one of the following pairs of paths G – F and D – A = (7 + 3) = 16 G – D and F – A = (5 + 4) + 6 = 15 G – A and D – F = (6 + 6) + 5 = 17 Which of these pairings adds the least amount of extra distance? 3 A 8 E B 5 4 7 12 G D 3 6 4 2 5 7 6 C F 6

16 Route Inspection 3 A 8 E B 5 4 7 12 G D 3 6 4 2 5 7 6 C F 6
To complete his rounds and finish at the place he started, he will have to repeat one of the following pairs of paths G – F and D – A = (7 + 3) = 16 G – D and F – A = (5 + 4) + 6 = 15 G – A and D – F = (6 + 6) + 5 = 17 The middle pairing adds the least amount of extra distance. 3 A 8 E B 5 4 7 12 G D 3 6 4 2 5 7 6 C F 6

17 Route Inspection 3 A 8 E B 5 4 7 12 G D 3 6 4 2 5 7 6 C F 6
G – D and F – A = (5 + 4) + 6 = 15 The total distance = sum of all the edges + repeated edges = = 93 We can make it easier to find a route by drawing in extra edges on the repeated route. 3 A 8 E B 5 4 7 12 G D 3 6 4 2 5 7 6 C F 6

18 Route Inspection 3 A 8 E B 5 4 7 12 G D 3 6 4 2 5 7 6 C F 6
An example route is: AFCDFEGDEBDBGBCGFA, total length 93. 3 A 8 E B 5 4 7 12 G D 3 6 4 2 5 7 6 C F 6

19 Route Inspection Graph Odd vertices Repeated edges None 2
Summary Graph Odd vertices Repeated edges None 2 The shortest path joining the two odd vertices 4 Try all possible pairings of the odd vertices and choose the smallest combination.


Download ppt "Route Inspection Which of these can be drawn without taking your pencil off the paper and without going over the same line twice? If we introduce a vertex."

Similar presentations


Ads by Google