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:
- g
Graph Graph to be used (the edge directions are ignored).
- pos
VertexPropertyMap(optional, default:None) If provided, the positions will be stored in this property map.
- shape
str(optional, default:"square") Shape of the layout area:
"square","circle","heart","cube", or"ball"(the last two in three dimensions).- n_iter
int(optional, default:None) Number of iterations, which must be at least 2. If not given, \(V\) is used.
- diameter_initial
float(optional, default:None) Initial radius (in hops) of the neighborhoods that move together. If not given, \(\sqrt{V}\) is used.
- diameter_final
float(optional, default:1.) Final radius of the neighborhoods.
- learning_initial
float(optional, default:0.8) Initial learning constant.
- learning_final
float(optional, default:0.2) Final learning constant.
- g
- Returns:
- pos
VertexPropertyMap The vertex positions.
- pos
See also
fruchterman_reingold_layoutFruchterman-Reingold spring-block layout
sfdp_layoutMultilevel force-directed layout
random_layoutRandom 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, andlearning_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") <...>
Gursoy-Atun layout of a square lattice in a circle.#