Best practice to build adjacency list

I am not sure what you mean by “huge overhead for rebuilding original set”. Adding a new element to a set is efficient.

1 Like