Changed edges data stucture from list to dictionary