som_connection
Purpose
To create a connection matrix of SOM 'hexa' and 'rect' negihborhoods
Syntax
C = som_connection(S)
Description
Creates a connection matrix of SOM 'hexa' and 'rect'
neighborhoods. The connections are defined only in the upper
triangular part to save some memory.
Function SOM_UNIT_NEIGHS does the same thing, but also has values
in the lower triangular. It is also slower, except for
'toroid' shape because in that case this function calls
Som_unit_neighs...
Required input arguments
S map topology
(map struct) S.topol is used to build the matrix
(topol struct) topology information is used to build the matrix
(cell array) of form {lattice, msize, shape}, where
lattice: 'hexa' or 'rect'
msize : 1x2 vector
shape : 'sheet', 'cyl or 'toroid'
Output arguments
C (sparse) munits x munits sparse matrix which describes
nearest neighbor connections between units
Example
C = som_connection('hexa',[3 4],'sheet');
full(C)
ans =
0 1 0 1 0 0 0 0 0 0 0 0
0 0 1 1 1 1 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0 0 0
0 0 0 0 1 0 1 0 0 0 0 0
0 0 0 0 0 1 1 1 1 0 0 0
0 0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 1 0 1 0 0
0 0 0 0 0 0 0 0 1 1 1 1
0 0 0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0 0 0
See also