Question: How would you use graph theory to set up the following type of problem, with the aim of writing a computer program to solve them?
How would you use graph theory to set up the following type of problem, with the aim of writing a computer program to solve them?
"You have n empty containers, which have capacities of
M1,M2,,Mn
litres of water respectively. You can fill any container from a tap; dump any container into a drain; or pour from one container to another until either the first container is empty, or the second container is full. Your aim is to get a container with exactly T litres of water in it."
Given the numbers n,
M1,M2,,Mn
and T, what graph would you set up to model the problem (describe what the vertices and edges of the graph are)?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
