Modified Graph class to identify the start and target nodes upon construction