It might be easier to use the [NetworkX graph library](http://networkx.github.io/)  to store the underlying graph structure.  We can discuss the details at the iteration meeting or the next weekly meeting.