Implement a simple graph class