building the topology