Add getNodes() and addNode() methods for the Graph class.