update_adj_list function

Update adjacency list.