An element represents an edge as follows. If consists of exactly two elements of , draw a line between these two vertices. If consists of exactly one element of , draw a line from this vertex to itself.
Suppose we have jugs with capacities litres, respectively. Jug is full of water and jugs are empty. Can we divide the water into two exactly equal parts? If so, find the most efficient pouring sequence.
Construct a graph with points labelled by elements , where are the volumes of water in jugs , respectively. Join two points with a line segment if we can obtain one set of volumes from the other in a single pour. We will ignore pours that return us to a configuration previously achievable by fewer pours.
Figure14.1.7.Graph to track possible jug fill states.
Following the left leg of the graph gets us to the desired configuration in pours.