Choosing optimal network structure