We represent relationships in a network with edges, and often we will want to attach a measurement to each edge to show how the relationships are different. For example, if we were making a network based on the roads between towns, we might want to show the distances between towns, or how long it takes to drive, as well as, which towns are connected.
To show this kind of extra detail, we add a number to each edge, and call this number a weight. Here is an example:
A common problem posed in networks is to find the path of lowest weight between two vertices. For example, finding the best (fastest, shortest, cheapest) route between two destinations, which is what GPS navigation systems are built for. Let's examine some approaches to solving this problem.
Take for example this network of towns:
The weights represent travel time in minutes, and we want to get from $A$A to $B$B via the optimal (fastest) path. Here are three paths we could take:
This last path is close to the answer, but we can get from $A$A to $D$D even faster if we take a shortcut through $C$C:
This path only takes $2+1+4=7$2+1+4=7 minutes, and is the fastest way to get from $A$A to $B$B. We just need to be careful and check each path, seeing if we can improve upon it by adding or removing destinations along the way.
Can you see a path that has not been listed? Can you justify not checking this path?
In theory, when trying to find the shortest path by observation we should check every path and its length. However, we can eliminate some options as possibilities by looking at the structure of the network carefully first. Firstly, recall no path will pass through the same vertex or use the same edge more than once. Also, the shortest path will not take "the long way around". For our example above the shortest path would never use the section $C,E,D$C,E,D (which take $6$6 minutes) when the path could flow directly from $C$C to $D$D in just $1$1 minute.
We can perform the same sort of analysis on directed graphs as well, just be careful to follow the direction on the arrows when forming paths.
Using trial and error is an appropriate method, however, we need to be careful and sometimes it is difficult to ensure all paths are checked. Next lesson we we look at a different systematic approach to find the shortest path.
Find the weights of the following paths in this network:
Path $Y$Y-$E$E-$D$D:
Path $A$A-$B$B-$Z$Z-$X$X:
Path $X$X-$C$C-$A$A-$B$B-$Z$Z:
The following map shows all possible routes in Tobias's town. Tobias travels from his home to work on a daily basis.
If Tobias's house is at vertex $C$C, and work is at vertex $I$I, what is the shortest path between the two places?
$C,A,B,F,I$C,A,B,F,I
$C,E,G,J,I$C,E,G,J,I
$C,B,G,I$C,B,G,I
$E,B,F,I$E,B,F,I
$C,A,D,B,H,J,I$C,A,D,B,H,J,I
$I,F,D,A,C$I,F,D,A,C
Sometimes when finding the shortest path we have additional restrictions such as we require the path to pass through each vertex. For example, if we were planning a delivery route between several different houses, we would be looking for a path that went to each house (vertex) on the delivery route and did so in the shortest time. These types of problems are the basis of the famous travelling salesman problem, defined in the 1800s by the Irish mathematician W. R. Hamilton and by the British mathematician Thomas Kirkman.
To find solutions to such problems we look for special paths named after the mathematician W. R. Hamilton. A path that visits each vertex exactly once is called a Hamiltonian path, if the path forms a cycle then it is called a Hamiltonian cycle (or Hamiltonian circuit). A network which contains a Hamiltonian path is known as traceable.
Here are three networks: the first has a Hamiltonian path highlighted, the second has a Hamiltonian cycle highlighted, and the third does not have a Hamiltonian path.
To solve these types of problems we will use trial and error, together with some logic.
Is it possible to draw a Hamiltonian path on the following diagram?
Yes
No
A private school bus is to pick up students from a certain area. The following map shows the routes connecting the students' houses.
The bus driver wants to save as much time as possible on his route. If he starts his route at vertex $D$D, what is the shortest path that visits each house exactly once?
Represent the path by listing the vertices in order, separated by commas.
A rock band is planning a tour across several cities. The following table represents the routes and distance between the cities at which they will be performing.
Starting City | Ending City | Distance |
---|---|---|
$A$A | $C$C | $9$9 |
$A$A | $F$F | $6$6 |
$B$B | $E$E | $11$11 |
$B$B | $F$F | $5$5 |
$C$C | $D$D | $3$3 |
$C$C | $F$F | $7$7 |
$E$E | $D$D | $5$5 |
$E$E | $F$F | $8$8 |
Which of the following graphs does the table represent?
Using either the correct graph or table given, find the shortest route for the rock band to cross starting at city $A$A and passing by each city only once.
List the vertices in order, separated by commas.