Changed ArrayList to LinkedList and changed edgesFrom/To functions