gursoy_atun_layout

gursoy_atun_layout#

graph_tool.draw.gursoy_atun_layout(g, pos=None, shape='square', n_iter=None, diameter_initial=None, diameter_final=1.0, learning_initial=0.8, learning_final=0.2)[git][source]#

Calculate a layout of the graph with the Gursoy-Atun self-organizing map.

Parameters:
gGraph

Graph to be used (the edge directions are ignored).

posVertexPropertyMap (optional, default: None)

If provided, the positions will be stored in this property map.

shapestr (optional, default: "square")

Shape of the layout area: "square", "circle", "heart", "cube", or "ball" (the last two in three dimensions).

n_iterint (optional, default: None)

Number of iterations, which must be at least 2. If not given, \(V\) is used.

diameter_initialfloat (optional, default: None)

Initial radius (in hops) of the neighborhoods that move together. If not given, \(\sqrt{V}\) is used.

diameter_finalfloat (optional, default: 1.)

Final radius of the neighborhoods.

learning_initialfloat (optional, default: 0.8)

Initial learning constant.

learning_finalfloat (optional, default: 0.2)

Final learning constant.

Returns:
posVertexPropertyMap

The vertex positions.

See also

fruchterman_reingold_layout

Fruchterman-Reingold spring-block layout

sfdp_layout

Multilevel force-directed layout

random_layout

Random layout

Notes

The layout of Gursoy and Atun [gursoy-neighbourhood-2000] is a self-organizing map, implemented with the Boost Graph Library: in iteration \(t = 0, \dots, T - 1\), where \(T\) is n_iter, a point \(\boldsymbol\xi\) is drawn uniformly in the area, and the vertex \(c\) closest to it and its neighborhood move towards it,

\[\boldsymbol x_v \leftarrow \boldsymbol x_v + \epsilon_t e^{-h_v^2/2r_t^2}(\boldsymbol\xi - \boldsymbol x_v)\]

for every vertex \(v\) at a hop distance \(h_v \le r_t\) from \(c\), with the radius and the learning constant

\[r_t = \left\lfloor D_0\left(\frac{D_1}{D_0}\right)^{t/(T-1)} \right\rfloor, \qquad \epsilon_t = \epsilon_0\left(\frac{\epsilon_1}{\epsilon_0} \right)^{t/(T-1)},\]

where \(D_0\), \(D_1\), \(\epsilon_0\), and \(\epsilon_1\) are diameter_initial, diameter_final, learning_initial, and learning_final (with \(r_t = 0\), only \(c\) moves). The vertices thus fill the area uniformly while neighbors stay close. The areas are the unit square \([0, 1]^2\), the unit disk, the unit cube \([0, 1]^3\), the unit ball, and the heart shape of the Boost Graph Library, about 2400 units wide (in which the moves between the two lobes go through the notch at the origin). The initial positions are drawn uniformly in the area.

References

[gursoy-neighbourhood-2000]

Attila Gürsoy and Murat Atun, “Neighbourhood preserving load balancing: A self-organizing approach”, Euro-Par 2000 Parallel Processing, Lecture Notes in Computer Science 1900, 234-241 (2000), DOI: 10.1007/3-540-44520-X_32 [sci-hub, @tor]

Examples

>>> g = gt.lattice([20, 20])
>>> pos = gt.gursoy_atun_layout(g, shape="circle", n_iter=10000)
>>> gt.graph_draw(g, pos=pos, output="lattice-gursoy-atun.pdf")
<...>
../_images/lattice-gursoy-atun.png

Gursoy-Atun layout of a square lattice in a circle.#