adding index to edges