changed edges to a linked list instead of a vector