More robust topology generation.

Also, support for topologies using exact match (without quantization).