https://github.com/deepmind/clrs/blob/master/clrs/examples/run.py