Graph constructor class