Time complexity of removing a vertex from a graph represented as collection of adjacency lists
In step 2, vertices with no neighbours have an empty adjacency list, but it still takes one time step to realise that the list is empty. So the runtime is $\sum_{i\in[n]\smallsetminus \{d\}} \max(1,e_i)=O(n+e)$.