`network.torusNearestNeighbors(sizex, sizey, neighbours, node= dynNode, edge = weightedEdge)`- Adds a 2-dimensional, cyclic lattice (torus) to the network, in which each node is connected to a fixed number of nearest neighbours.

`sizex`: integer- Size of the torus in x-direction
`sizey`: integer- Size of the torus in y-direction
`neighbours`: integer- The number of neighbours each node is connected to. If the choice cannot be made unique, neighbours are chosen randomly.
`node`: node template- Every added node is a copy of this template.
`edge`: edge template- Every added edge is a copy of this template.

```
import conedy as co
N = co.network()
N.torusNearestNeighbors (40,40,36.0, co.node(), co.weightedEdge()) #creates a torus of nodes, where each is connected to its 8 (4 direct, 4 diagonal) nearest neighbors and to 2 neighbors with distance 2 randomly chosen
print "should be 36.0:" + str(N.meanDegree())
```

```
network N;
N.torusNearestNeighbors (40,40,36.0, node, weightedEdge); #creates a torus of nodes, where each is connected to its 8 (4 direct, 4 diagonal) nearest neighbors and to 2 neighbors with distance 2 randomly chosen
print "should be 36.0:" + N.meanDegree() + newline;
```