circular_graph

Contents

circular_graph#

graph_tool.generation.circular_graph(N, k=1, self_loops=False, directed=False)[source]#

Generate a circular graph.

Parameters:
Nint

Number of vertices.

kint (optional, default: True)

Number of nearest neighbors to be connected.

self_loopsbool (optional, default: False)

If True, self-loops are included.

directedbool (optional, default: False)

If True, a directed graph is generated.

Returns:
circular_graphGraph

A circular graph.

Examples

>>> g = gt.circular_graph(30, 2)
>>> pos = gt.sfdp_layout(g, cooling_step=0.95)
>>> gt.graph_draw(g, pos=pos, output="circular.pdf")
<...>
../_images/circular.png

A circular graph with \(N=30\) vertices, and \(k=2\).#