Graph Theory37 sections · 1633 units
Open in Course

Mail Delivery - Algorithm

Apply Hierholzer from vertex 1.

Algorithm: 1.1. Check if all vertices have even degree

2.2. Check if graph is connected (DFS from vertex 11)

3.3. If checks pass, run Hierholzer starting from vertex 11

4.4. Output the resulting path

Implementation detail: For undirected graphs, each edge appears twice in the adjacency list. When you use one direction, mark both as used.

A common approach: store edge indices and mark edges by index rather than by endpoint pairs.

This runs in O(E)O(E) time and uses O(E)O(E) space.