circular_graph

Contents

circular_graph#

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

Generate a circular graph.

Parameters:
Nint

Number of vertices.

kint (optional, default: 1)

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.

See also

named_graph

Also gives this graph, as named_graph("circular", ...), with the other named graphs and deterministic families

Examples

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

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