Solution to the cubes problem.

Converts the cube data structure to a graph, and uses dijsktra's
algorithrm. Dijsktra's implementation borrowed from:

https://gist.github.com/econchick/4666413