Graph class and tests.