More performance improvements -- eliminated a call to set on every node insert by caching the set of relations, among other things.
Moved miscellaneous functions to common from directed-graph.core.