Refactor.

Make code-flow easier to follow in the generator functions.
Introduce support for building tests.
Refactor.

Centralize all graph-traversal operations to the 'traverse' function.
Replace direct path manipulation with 'os.path'.