mdickinson/refcycle — pull request #15 by mdickinson (2013-12-14 11:00:07+00:00)
Title: Refactor internals.

This PR refactors some of the internals to improve readability, remove duplication, and generally clean up the code.

Internal changes:

- Add and use `KeyTransformDict` and `ElementTransformSet` classes to abstract away the business of extracting object identities for lookups and vertex sets. This allows us to express the graph algorithms more directly, without the distractions of moving between an object and its `id`.

- Make `IDirectedGraph` an abstract base class (type `abc.ABCMeta`), and mark the required abstract properties and methods.

- Remove `ObjectGraph.to_dot` implementation; delegate to `AnnotatedGraph.to_dot` instead to avoid duplication. Remove caches of annotation information on the `ObjectGraph` itself.

There's one API addition: `IDirectedGraph` instances now always have an `edges` attribute, returning a collection of the edges.