star_layout#
- graph_tool.draw.star_layout(g, center=None, order=None, radius=1.0, pos=None)[git][source]#
Place one vertex at the center and the others on a circle around it.
- Parameters:
- g
Graph Graph to be used.
- center
intorVertex(optional, default:None) The central vertex. If not given, the first vertex of
orderis used.- orderiterable of
int(optional, default:None) The vertices in their order around the circle (the center may be included, and is then skipped). If not given, the order of the vertex indices is used.
- radius
float(optional, default:1.) Radius of the circle.
- 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
shell_layoutVertices on concentric circles
radial_tree_layoutRadial layout of a tree
Notes
The center is placed at the origin, and the other vertices at equal angles, counterclockwise from the positive \(x\) axis: the \(k\)-th of the \(n\) other vertices in the order, with \(k = 0, \dots, n - 1\), is placed at
\[\boldsymbol x_k = R\left(\cos\frac{2\pi k}{n}, \sin\frac{2\pi k}{n}\right),\]where \(R\) is
radius. The edges are ignored.Examples
>>> g = gt.collection.data["karate"] >>> pos = gt.star_layout(g, center=33) >>> print(pos[33].a, pos[0].a) [0. 0.] [1. 0.] >>> gt.graph_draw(g, pos=pos, output="star-layout-karate.pdf") <...>
Star layout of the karate club network, with vertex 33 at the center and the other vertices in the order of their indices.#