Rework several modules to support calculation of number of detours per link. Simplify links iterations by using new iter_links method of RailwayNetwork class.