Building the network structure