edges storage changed to arraylist from linkedlist.