Move graph 'helper' classes outside Graph.