**Name:**

topology::Distance - compute distance between nodes

**Synopsis:**

from_gid to_gid Distance -> double

from_pos to_gid Distance -> double

**Description:**

This function returns the distance between the position of the "from_gid"

node or the explicitly given "from_pos" position and the position of the

"to_gid" node. Nodes must be parts of topology layers.

The "from" position is projected into the layer of the "to_gid" node. If

this layer has periodic boundary conditions (EdgeWrap is true), then the

shortest distance is returned, taking into account the

periodicity. Fixed grid layers are in this case extended so that the

nodes at the edges of the layer have a distance of one grid unit when

wrapped.

Example:

topology using

<< /rows 5

/columns 4

/elements /iaf_psc_alpha

>> CreateLayer ;

4 5 Distance

[0.2 0.3] 5 Distance

**Parameters:**

from_gid - int, gid of node in a topology layer

from_pos - double vector, position in layer

to_gid - int, gid of node in a topology layer

Returns:

double - distance between nodes or given position and node

**Author:**

Hans E Plesser, Kittel Austvoll

See also: Displacement, GetPosition

**Source:**

/home/graber/work-nest/nest-git/nest-simulator/topology/topologymodule.cpp