GraphAware Blog - State Machine

Find out what's new in the Neo4j world

Solving the bucket-filling problem with Neo4j

02 Sep 2018 by Vince Bickers · 7 min read Neo4j State Machine Optimisation Problems Shortest Path

IntroductionIn the bucket filling problem you are given two empty buckets, each of a certain capacity, and a large supply of water. By filling, emptying and transferring water between the two buckets, you must try to end up with a situation where one of the buckets contains a required volume of water, or where both buckets together contain the required volume.One popular instance of the problem has two buckets with a capacity of 5 and 3 litres respectively, with the goal being to find a solution where one bucket contains exactly 4 litres. One solution is shown below: Step Action...