shell_layout#
- graph_tool.draw.shell_layout(g, shells=None, rotate=None, scale=1.0, pos=None)[git][source]#
Place the vertices on concentric circles.
- Parameters:
- g
Graph Graph to be used.
- shellslist of iterables of
int, orVertexPropertyMap(optional, default:None) The vertices of every shell, from the innermost one, in their order around the circle; or an integer vertex property map with the shell of every vertex, ordered by value, with the vertices of the same shell in the order of their indices. If not given, all vertices are on one shell.
- rotate
float(optional, default:None) Angle by which every shell is rotated with respect to the previous one. If not given, \(\pi/S\) is used, where \(S\) is the number of shells.
- scale
float(optional, default:1.) Radius of the outermost shell.
- pos
VertexPropertyMap(optional, default:None) If provided, the positions will be stored in this property map.
- g
- Returns:
- pos
VertexPropertyMap The vertex positions.
- pos
See also
circle_layoutVertices on a circle
star_layoutVertices on a circle around a central vertex
radial_tree_layoutRadial layout of a tree
Notes
The \(j\)-th of the \(n_s\) vertices of shell \(s = 1, \dots, S\), with \(j = 0, \dots, n_s - 1\), is placed at
\[\boldsymbol x_{s,j} = r_s\left(\cos\theta_{s,j}, \sin\theta_{s,j}\right), \qquad \theta_{s,j} = \frac{2\pi j}{n_s} + s\alpha,\]where \(\alpha\) is
rotate, and the radius is \(r_s = s\,c/S\), where \(c\) isscale, or \(r_s = (s - 1)c/(S - 1)\) if the first shell has a single vertex (and \(S > 1\)), which is then placed at the center, so that the outermost shell has radius \(c\) in both cases. The edges are ignored.Examples
>>> g = gt.collection.data["karate"] >>> d = gt.shortest_distance(g, source=0) >>> pos = gt.shell_layout(g, shells=d) >>> gt.graph_draw(g, pos=pos, output="karate-shell.pdf") <...>
Shell layout of the karate club network, with the shells given by the distances from vertex 0.#