- What is the difference between a trail, a path, a circuit and a cycle?
- A trail is a walk with no repeated edge, and a path is a walk with no repeated vertex. A circuit is a closed trail, starting and ending at the same vertex, and a cycle is a closed path that repeats no other vertex. Every path is a trail and every cycle is a circuit. A circuit may pass through a vertex twice, so it need not be a cycle.
- How many edges does a spanning tree have?
- A spanning tree joins every vertex of a connected graph with no cycles, so a spanning tree with n vertices has n - 1 edges. For a connected graph with 9 vertices and 14 edges, the spanning tree has 9 - 1 = 8 edges, so 14 - 8 = 6 edges must be removed. A connected graph with 9 vertices cannot have only 7 edges, because 7 < 8.
- How do I tell whether a graph has an Eulerian circuit or an Eulerian trail?
- Write down the degree of every vertex and count the odd ones. An Eulerian circuit exists in a connected graph when every vertex has even degree. An Eulerian trail that is not a circuit exists when exactly two vertices have odd degree, and it starts at one and ends at the other. With more than two odd vertices there is no Eulerian trail. For a graph with odd vertices A and C, an Eulerian trail such as A-B-C-D-A-C exists.
- How do I use Kruskal's algorithm to find a minimum spanning tree?
- List the edges in increasing order of weight, then take each edge in turn. Add it unless it forms a cycle with the edges already chosen, and stop when n - 1 edges have been chosen. The weight of the MST is the sum of those chosen weights. In one example the edges EF, CD, AB, BD and DE are chosen, giving a total weight of 3 + 4 + 5 + 6 + 8 = 26. The edge BC is rejected because it would form a cycle.
- Why is my Chinese postman route too short when I pair up the odd vertices?
- Pairing odd vertices must use the shortest route between each pair, not always the direct edge. Between A and C the route A-B-C has length 4 + 3 = 7, which is shorter than the direct edge 8. Add the total weight of all edges to the least pairing sum, 5 + 3 = 8 for AD and BC, to get 34 + 8 = 42 for the route that uses every road.
- How do I find upper and lower bounds for the travelling salesman problem?
- The nearest neighbour algorithm gives an upper bound: it moves to the nearest unvisited vertex each time and returns to the start, and the least weight cannot be more than that cycle's length. The deleted vertex algorithm gives a lower bound: find a minimum spanning tree of the remaining vertices, then add the two smallest weights of edges at the deleted vertex. For the five villages, the upper bound is 30 km.