Format docstrings and comments for Graph better.
Reorganize and add tests for Graph.