Graph Class Implementation