Use std::unique_ptr and move logic for adjacency list implementation