postal-address
postal-address copied to clipboard
Use a DAG for territory aliases
Territory code aliases implementation is quite a mess, and to make it easier to maintain, use a directed acyclic graph to store the subdivision / country relationship as well as aliases.
With such a structure, we can easily solve #5 and check for stupid cycles in unit tests.
I think I'll leverage the NetworkX package to do so.
This might help solve once for all unsupported edge-cases. See: https://github.com/online-labs/postal-address/commit/5b589f8b1f9ec4cc2aa3a18e82bbc4a994b538d3 and https://github.com/online-labs/postal-address/commit/fe73027343dacbd33a7309e951473a79b105c119 .