loosened the type of edges list in Graph to List from ArrayList.