The Bridges of Konigsberg by hjkuiw354


									      Modelling with networks

     MASA/SASTA conference

                                   Amie Albrecht
peterpudney/mathematics_applications/ OR grab a CD
•   The Mayor of Königsberg wrote to the famous Swiss mathematician, Leonard Euler,
    in 1736 with the following problem:
       “The problem, which I understand is quite well known, is stated as follows: In the town of
       Königsberg in Prussia there is an island called Kneiphof, with two branches of the river Pregel
       flowing around it. There are 7 bridges – a, b, c, d, e, f and g – crossing the two branches. The
       question is whether a person can plan a walk in such a way that he will cross each of these bridges
       once but not more than once. I was told that while some denied the possibility of doing this and
       others were in doubt, no-one maintained that it was actually possible.”

    Can you find a path that crosses each bridge exactly once? (This is called an Euler

•   In 1875, the people of Königsberg built an extra bridge over the river on the left.
    Can you find an Euler path now?

•   Let’s start by examining how Euler solved the problem. Euler labelled the locations
    as shown below. He realised that there is extraneous information that is not required
    to solve the problem, and that it is only the way the landmasses are connected that is
    important. Euler created a mathematical model called a graph or network with the
    landmasses as nodes and the bridges as edges as shown.
•   There is a simple observation that Euler made to solve the problem. Can you see
    what it is?

    The answer relates to the number of edges attached to each node. This is called the
    degree of the node. For example, node A has degree 3 and node B has degree 5.
    Let’s consider an isolated node as shown below. If there are an odd number of
    edges, there is no way to exit the node as all the edges have been used.

    Euler’s conclusion was that every node (except the start and end node) must have an
    even number of edges attached to it. Since every node in the graph of the
    Königsberg Bridge problem has an odd degree, no Euler path exists.

    The history of the bridges is interesting. Each was given a name: Shopkeeper,
    Blacksmith, Wooden, Honey, Green, Giblets, High. Two were bombed during the
    war, two were replaced by the Russians with a freeway, one was rebuilt and two
    original bridges still remain.

1.   Can you find a path to solve the following problem:
                • Start at any location,
                • walk over each bridge exactly once.
     Trace out your path with arrows.

2.   In 1875, an extra bridge was added. Is it now possible to solve the problem?

Each of these problems can be represented more simply by a network. Problem 1, with
seven bridges, can be represented by the following network (notice that the land masses
have been labelled A, B, C, and D):

           Problem 1: The Seven Bridges of                                    The problem represented by a
           Konigsberg                                                         network

The nodes in the network represent the land masses, and the edges joining each node
represent the bridges.

3.     Draw the network that would represent problem 2 (where one bridge has been added).
                  • The nodes represent the land masses
                  • The edges represent the bridges connecting the land masses.

                                                          List the degree of every node in the network:

                                                          Is there an Euler path in this network? How can
                                                          you tell?
In a kingdom in a faraway land live two feuding brothers. The northern bank of the river is occupied by the
castle of the Blue Prince; the southern by that of the Red Prince. The east bank is home to the Bishop's
church; and on the small island in the center is an inn.

Draw a network that would represent the problem below:

It is customary among the townsmen, after some hours in the inn, to attempt to walk over each of the
bridges exactly once. Many have returned for more refreshment claiming success. However, none have been
able to repeat the feat by the light of day.

4.     The Blue Prince, having analyzed the town's bridge system, concludes that it is not possible. He
       contrives a plan to build an eighth bridge so that he can begin in the evening at his castle, walk over
       each of the bridges exactly once, and end at the inn to brag of his victory. Of course, he wants the
       Red Prince to be unable to duplicate the feat.

       Where does the Blue Prince build the eighth bridge? (Draw the network below with the extra bridge

5.   The Red Prince, infuriated by his brother's solution to the problem, wants to build a ninth bridge,
     enabling him to begin at his castle, walk over each of the bridges exactly once, and end at the inn to
     rub dirt in his brother's face. His brother should also no longer be able to achieve the feat.

     Where does the Red Prince build the ninth bridge?

6.   The Bishop has watched this furious bridge-building with dismay. It upsets the peace of the town,
     and worse, it contributes to excessive drunkenness. He wants to build a tenth bridge that allows all
     the inhabitants to walk the bridges and return to their own beds.

     Where does the Bishop build the tenth bridge?

     Trace out the circuit that the Red Prince would take.

1.   Can you paint the basketball court without taking your pencil off the page?

     Use a network to describe why this is or is not possible.

2.   Below is the floor plan for an art museum. A security guard must walk through
     and check each of the rooms and go through each door exactly once, before returning to her
     starting spot. Draw and label a network that creates an Euler circuit for the guard.

                    !                   "

                #              $               %

This problem is not named after a Chinese postman but rather a Chinese mathematician
who posed the problem.
The problem is to start at the post office and return, having delivered letters along every
street. (He can deliver letters to both sides of the street at the same time.) If the street
length is 1, what is the minimum distance the postman needs to travel? Ideally it is 12.
Is 12 possible?

We can see that there is no Euler cycle because the degree of some nodes is odd (nodes
2, 4, 6 and 8). Therefore the postman must travel down some streets again. This is
called dead-heading. We call the process of adding extra edges so that an Euler cycle
is possible eulerising the graph. The example on the left is the correct solution with a
minimum distance of 16. Notice that the nodes that were of odd degree now have even
degree. Node 5 originally had an even degree but we added an even number of edges, so
it still has even degree.
What is wrong with the solution on the right? (We have added edges where none
previously existed.)

The costs need not represent the street lengths. They could represent the time taken to
travel the street, the cost of traveling on the road, etc. The model could also represent a
different routing problem, but the solution process is the same.
Why is this model unrealistic? In general street networks, all streets are not the same
length. To do this, we solve a matching problem. (See the resources on the School of
Mathematics and Statistics website: In practice, we may also
consider the problem of minimizing U-turns or right hand turns at large intersections
and onto busy roads to improve the safety of the Euler cycle we find.

Names: _________________________________________________________

1.   A postman needs to travel down every street to deliver letters to all the houses. The goal is to find
     the shortest path so that:
                • We begin at the post office
                • We travel down every street at least once
                • We finish back at the post office
     On the map below, trace out your path with arrows:

                                 Post office

2.   Every street is 1 km long. What is the total distance we have travelled?


3.   The problem is represented by this network
                                                          1                2                3
     (notice that the nodes represent the
     intersections and the edges represent the

     a)     Draw in extra edges to represent the          4                5                6
            streets you have to travel along twice:

     b)     Now list the degree of each node

                                                          7                8                9

4.   Draw in extra edges in the following network so that every node has an even degree. Use as few
     extra edges as possible:
Modelling real-world problems with networks

Nodes represent items of interest
land masses, towns, rooms, intersections, people, computers, ...

Edges represent physical connections or relationships between items
bridges, rail connections, aircraft routes, computer connections, roads, ...

It is only the connections that are important
(topological equivalence)
The Four Colour conjecture was first posed by Guthrie in 1852 who was colouring a
map of the counties of England. The Four Colour Theorem is an interesting historical
problem that has been a popular recreational pursuit as well as a topic of serious
mathematical research.
The Four Colour Theorem states that any map may be coloured using no more than four
colours in such a way so that no two adjacent regions receive the same colour. For
example, the map below of part of Europe has been coloured so that no two adjacent
regions have the same colour. However, more than four colours have been used.

This time we represent the countries with nodes and the borders with edges. In the
example below we have focused on a few countries:

Then, we colour the graph as before so that no two nodes connected by an edge receive
the same colour.
The Four Colour Theorem seemed to work for every map: real or imagined. Some
mathematicians became obsessed with proving the conjecture (when it would become a
theorem). To prove it, we only need to find a map that requires five colours.
The Four Colour Theorem was proven in 1976 by reducing the problem to 1476 cases
that were verified with a computer. To show that every possible map could fall into one
of these cases required over 500 pages of handwritten examples to be checked. Later,
the problem was reduced to 633 cases, shown on the next page.
Martin Gardner, a popular American columnist played an April Fools joke on his readers
in 1975. He claimed that the map shown below (with 110 regions) needed 5 colours.
The solution using 4 colours is shown on the right.
Many books and Internet pages have been devoted to The Four Colour Theorem –
many are very accessible to non-mathematicians. Simon Singh produced an excellent
radio program for the BBC. You can find it, ‘The Number Four’, at:
Zoo Design

Animal       Cannot be put with ...

Tiger        Antelope, Leopard, Ostrich

Leopard      Antelope, Rhino, Ostrich, Tiger

Antelope     Leopard, Tiger
                                                     Draw a network.
Rhino        Leopard, Ostrich
                                                     Use a node to represent an animal.
Ostrich      Tiger, Leopard, Rhino, Snake
                                                     Put an edge between two animals that
Snake        Ostrich
                                                     cannot be put in the same cage.

                                                     Colour the graph.

                                                     What is the minimum number of cages

Radio Frequencies

           KQAA        KQBB     KQCC        KQDD      KQEE      KQFF

KQAA           -         25       202          77        375      106

KQBB          25         -        175          51        148      222

KQCC         202        175           -        111       365       78

KQDD          77         51       111           -                 297

KQEE         375        148       365          78         -       227

KQFF         106        222       411          297       227        -

The Federal Communications Commission (FCC) monitors radio stations to make sure that their
signals do not interfere with each other. They prevent interference by assigning appropriate
frequencies to each station. How many different frequencies are needed for the six stations
located at the distances shown in the table, if two stations cannot use the same channel when
they are within 150 kilometres of each other?

3.   What is the minimum number of colours required to colour the states and territories of Australia so
     that states/territories that share a border do not have the same colour?

4.   Draw a network and find a colouring that uses four colours or less for the following map:
•   The lanes of traffic are called traffic flows and we label them as the direction the
    cars are travelling. Two flows are called compatible if they can enter the
    intersection at the same time, and incompatible if they cannot. Flows N and S
    are compatible in the example.
•   The sequencing of green light times for each flow is known as phasing traffic
    signals. We obviously want to do this so that incompatible flows do not have
    green lights at the same time.
•   Nodes now represent flows. The compatibility and incompatibility graphs (what
    does this mean?):

•   What is the relationship between them? They form a complete graph and are
    complements of each other.
•   What is the formula for the number of edges in a complete graph?
•   We want to colour the vertices of the graph so that two vertices joined by an
    edge do not share the same colour.

•   Then traffic flows with the same colour can proceed at the same time. We
    construct a signal pattern. (For example …)
•   What assumptions have we made? (Traffic streams are equally heavy, we do not
    synchronise traffic lights at different intersections so that cars traveling in the
    same direction have as few red lights as possible.)
•   Complete the large problem.
Mr. White and his wife invited four other couples for a party. When everyone
arrived, some of the people in the room shook hands. Of course, nobody shook hands
with himself or herself, nobody shook hands with his/her spouse, and nobody shook
hands with the same person twice.
After that, Mr. White asked everyone how many times they shook someone’s hand.
He received different answers from everybody.
How many times did Mrs. White shake hands with other people?
                                                                                                   Page 1

               Picking Deadlock: the key to solving train puzzles

Problem Description

Most of Australia’s long-haul rail network is single-line track, with occasional crossing
loops where two trains can pass each other. To pass each other, one train will move
from the mainline onto the crossing loop. The second train will travel on the mainline.
Once the mainline is clear, the first train will move from the crossing loop back onto the
mainline and continue it’s journey. Not all trains fit on all crossing loops.

The rail network can be represented as a graph with edges representing the rail track
segments and vertices (or nodes) representing where two (or more) track segments meet.

A train is shown as a coloured block pointing in a particular direction. Only one train
can occupy a segment at a time. Trains can move forwards only1 .

Train planners and train controllers plan train movements in order to avoid deadlock.
Deadlock occurs when it becomes impossible to move every train forwards to its destina-
tion. A deadlocked situation is shown below.

Deadlock is not always easy to detect; it is possible to move the trains into a situation
where the only possible moves will lead to deadlocked states.

Deadlock is easy to avoid when there are very few trains and many crossing loops. The
risk of deadlock increases when the traffic intensity increases or the number of crossing
loops decreases. Deadlock is also more likely when not all trains can use all crossing loops.
In the example below, the coloured cross indicates that a train of that colour can not use
that segment.

                                          xx            xx           xx

    Trains can physically reverse, but this is highly undesirable in practice. We therefore limit trains to
only the forward direction.

Amie Albrecht                                                             University of South Australia
                                                                                               Page 2

Importance of the Problem

In real life, train controllers use their experience to avoid deadlocks. However, researchers
are developing automated methods which quickly generate train timetables. These com-
puter methods need algorithms to help avoid constructing timetables that end in deadlock.
By examining small problems, we can learn about deadlock and hopefully develop rules
to avoid deadlock when generating train timetables2 .

Student Activities

The puzzles are designed to have students explore the ideas and complexity of deadlock.
The puzzles are different in design to the network representations shown in the Problem
Description, but equivalent.

Students should form groups of three or four and put coloured counters onto the blank
network layout corresponding to the starting position shown. Students must then deter-
mine which of the desired states can be reached from the initial state. (It is possible that
more than one state can be reached.)

Students may like to consider the following ideas when solving the puzzles:

       • Are there silly/smart moves to make which result in/avoid deadlock?

       • Which states cannot be reached from the initial state?

       • How many different possible final states are there for a particular problem?

       • How many different deadlocked states are there for a particular problem?

       • How many different decisions can be made? (This can be shown in a decision tree.)

       • Does the number of trains affect the probability of ending in deadlock?

       • ....

Solutions to Exercises

Puzzle 1 States 1 and 4 are possible.

Puzzle 2 States 1 and 2 are possible.

Puzzle 3 States 1 and 2 are possible.

Puzzle 4 States 1, 2 and 3 are possible.

Puzzle 5 States 1 and 4 are possible.
    Theoretical research has been done in finding deadlock avoidance schemes. In particular see Petersen
and Taylor (1983) and Mills and Pudney (2003). However, many schemes are conservative in that they
avoid risky decisions which may result in the optimal solution.

Amie Albrecht                                                          University of South Australia
                                                                                    Page 3

Mills, G. and Pudney, P. (2003). The effects of deadlock avoidance on rail network
 capacity and performance. In J. Hewitt, editor, MISG 2003: Mathematics in Industry
 Study Group, Adelaide, South Australia.

Petersen, E. and Taylor, A. (1983). Line block prevention in rail line dispatch and simu-
  lation models. Information Systems and Operations Research, 21(1), 46–51.


These puzzles were developed by Dr Peter Pudney. Researchers working in the Centre
for Industrial and Applied Mathematics at the University of South Australia are investi-
gating deadlock as part of research in developing software to quickly construct good train

The puzzles have been used in the Science at the Lakes program run at UniSA as well as
at the Investigator Science Centre.

Amie Albrecht                                                 University of South Australia
Puzzle 1

                 Starting position:

           (1)                        (3)

           (2)                        (4)

Puzzle 2

           Starting position:

  (1)                           (2)

Puzzle 3

           Starting position:

 (1)                            (3)

 (2)                            (4)

 Puzzle 4

            Starting position:

(1)                              (3)

(2)                              (4)

Puzzle 5

           Starting position:

 (1)                            (3)

 (2)                            (4)

Adhere to cardboard and punch out counters (roughly 2cm in diameter).

To top