






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Examination Board: AQA
Chapter 1 – Minimum connectors
Chapter 2 – Shortest path problem (Dijkstra’s algorithm)
Chapter 3 – Chinese postman problem
Chapter 4 – Travelling salesman problem
Chapter 5 – Graph theory
Chapter 6 – Matchings
Chapter 7 – Sorting algorithms
Chapter 8 – Algorithms
Chapter 9 – Linear programming
Chapter 2 – Shortest path problem (Dijkstra’s algorithm)
The minimum spanning tree of the previous chapter is used for connecting vertices with the minimum of distance/cost (eg installing cable for broadband internet), but doesn’t give an optimal route from one vertex to another. For this type of analysis, used for planning a route via a road network between two cities, for instance, Dijkstra’s algorithm is required.
Dijkstra’s algorithm Used for finding the shortest path through a network.
Step 1: Label the start vertex as 0. Step 2: Box this number (permanent label). Step 3: Label each vertex that is connected to the start vertex with its distance (temporary label). Step 4: Box the smallest number. Step 5: From this vertex, consider the distance to each connected vertex. Step 6: If a distance is less than the distance already in this vertex, cross out the distance and write in the new distance. If there was no distance at the vertex, write down the new distance. Step 7: Repeat from step 4 until the destination vertex is boxed.
Note: At step 4, the ‘smallest number’ refers to the smallest available temporary label – this does not need to be directly connected to the latest vertex to be permanently labelled.
Note: in some networks, called directed networks, sometimes edges will be unidirectional (eg, one- way streets). To apply Dijkstra’s algorithm in these cases, only consider edges leading away from the vertex.
If there are multiple start points , then we apply Dijkstra’s algorithm from the end point until we have reached each of the starting points. In this way we can find the shortest route.
Limitations: If we use Dijkstra’s algorithm on a network containing an edge that has a negative value it does not work.
To find the route of the shortest path using Dijkstra’s algorithm: As well as listing temporary values, we put a letter after each value, which indicates the preceding vertex on the route. We find the route by backtracking through the network from the finishing point.
Chapter 3 – Chinese postman problem
Dijkstra’s algorithm finds the shortest path between two vertices. The Chinese postman problem is an attempt to find the shortest path which traverses every edge. The obvious application would be a postman who needs to traverse each road in a given area.
A traversable graph is one that can be drawn without taking pen from paper and without retracing the same edge. In such a case the graph is said to have an Eulerian trail.
An Eulerian trail uses all the edges of a graph. For a graph to be Eulerian all the vertices must be of even order.
If a graph has two odd vertices then the graph is said to be semi-Eulerian. A trail can be drawn starting at one of the odd vertices and finishing at the other odd vertex.
Chinese postman algorithm Used for finding the shortest route which traverses all edges of a network.
To find a minimum Chinese postman route we must walk along each edge at least once and in addition must walk along the least pairings of odd vertices on one extra occasion.
Step 1: List all odd vertices. Step 2: List all possible pairings of odd vertices. Step 3: For each pairing find the edges that connect the vertices with the minimum weight. Step 4: Find the pairings such that the sum of the weights is minimised. Step 5: On the original graph add the edges that have been found in step 4. Step 6: The length of an optimal Chinese postman route is the sum of all the edges added to the total found in Step 4. Step 7: A route corresponding to this minimum weight can then be found by inspection.
Note: This algorithm readily calculates the length of the shortest path. The more complex the network, the harder it is to apply step 7 – identifying the route.
Before attempting to find the route for the Chinese postman algorithm, first use this method to identify which vertices appear, and how often :
Step 1: On the original diagram add the extra edges to make the graph Eulerian. Step 2: List the order of each vertex. At this stage each vertex will have an even order. Step 3: The number of times each edge will appear in a Chinese postman route will be half the order of its vertex, with the exception being vertex A (the start/finish vertex), as this will appear on one extra occasion. Note: There may be problems set where the start and finish vertices do not have to be the same. In a semi-Eulerian graph (exactly 2 odd vertices), the minimum route length therefore will simply be the sum of the edge lengths.
Chapter 5 – Graph theory
A graph consists of a finite number of points connected by lines. Points are normally called vertices or nodes. Lines are called edges or arcs.
A network , or weighted graph , is a graph whose edges are assigned a number. This can represent values such as the distance, the time or the cost relating to travelling between two points.
Two vertices are connected if there is an edge between them. A graph is fully connected if all pairs of vertices are connected, and connected if there is a route between all pairs of vertices.
A simple graph contains no loops (edges which go from a vertex back to the same vertex) and no duplicate edges (two different edges connecting the same pair of vertices).
The degree or order of a vertex is the number of edges connected to it.
A directed graph or digraph is one which has a specified direction for its edges.
A complete graph (Kn) is one in which every vertex is connected by exactly one edge to each of the other vertices (if connected by more than one edge it is merely fully connected).
A bipartite graph has two sets of vertices and the edges only connect vertices from one set to the other.
A trail is a sequence of edges of a graph such that the second vertex of each edge is the first vertex of the next edge, with no edge included more than once.
A path is a trail such that no vertex is visited more than once (except that the first vertex may be the last).
A cycle is a closed path with at least one edge.
A Hamiltonian cycle is a cycle that visits every vertex of a graph.
An Eulerian trail is a trail that traverses every edge of a graph exactly once. (If a graph possesses an Eulerian trail then the graph itself is called Eulerian. If the graph possesses a non-closed trail that uses all of its edges exactly once then the graph is called semi-Eulerian .)
A tree is a connected graph with no cycles.
Any tree that connects all the vertices of a graph is called a spanning tree for that graph. For a connected graph with n vertices each spanning tree has exactly n – 1 edges.
A minimum spanning tree is a spanning tree of minimum weight for a network.
A graph may be represented by a matrix, which is called an adjacency matrix. Each row and column represent a vertex of a graph and the number in the matrix gives the number of edges joining the pair of vertices.
Chapter 6 – Matchings
Matchings describe how bipartite graphs can be linked.
Pairing vertices of one of the sets to vertices of the other set in such a way that no two edges have a common vertex is called a matching
A maximum matching is a matching that contains the same number of edges as there are vertices on either of the two sets.
A complete matching is a matching that contains the same number of edges as there are vertices on either of the two sets.
Note: Although from any set of information a maximum matching is always possible, a complete matching is not always possible.
Alternating path algorithm Used to improve a matching to find a maximal matching.
The principle is to start with a vertex in one set that is not in the initial match and alternate between the two sets until we finish at a vertex in the other set that was not in the initial match. This is called an alternating path.
Step 1: From your initial matching, find a vertex on the left-hand subset not in the initial match and connect this vertex to a vertex on the right-hand set. Step 2: If the right-hand vertex is not in the initial matching then add this to the initial matching and repeat step 1. If the right hand vertex is in the initial matching go to step 3. Step 3: Add the new edge to the matching and remove from the initial matching the edge linking this vertex to the left-hand side. Repeat step 1 using the vertex that has just been removed from the matching. Step 4: Continue in this way until you have a complete matching or there is no further improvement that can be made.
Chapter 8 – Algorithms
Any algorithm must have the following properties:
When using flow charts :
When an algorithm is written as a series of instructions :
Note: By convention, line numbers are written in multiples of 10, so that amendments or corrections can be inserted without needing to renumber the lines.
Print indicates the production of an output value.
Goto can be used to jump to a particular line depending on given conditions.
Chapter 9 – Linear programming
Linear programming problems in industry often have many constraints and variables, and require a large number of equations. We will be dealing with problems in only two dimensions, and displaying inequalities on standard co-ordinate axes as a graph.
When an inequality is displayed on a graph, the feasible region is indicated by being unshaded , the excluded region by the shaded part of the graph.
A linear programming problem must first be formulated by defining an objective function.
Eg:
The feasible region can be illustrated on a graph as shown, and the objective function can be drawn as a family of lines – increase P until the line is on the point of leaving the feasible area. This point will give the and values which maximise P:
Produced by A. Clohesy; TheChalkface.net