hiperwalk.Cycle#

hiperwalk.Cycle(num_vert, multiedges=None, weights=None, copy=False)[source]#

Cycle graph constructor.

A cycle graph is a graph that forms a single closed loop, where each vertex is connected to exactly two other vertices, forming a circular structure.

Parameters:
num_vertint

The number of vertices in the cycle.

multiedges, weights: matrix or dict, default=None

See Graph Constructors.

copybool, default=False

See Graph Constructors.

Returns:
hiperwalk.Graph

Returns an instance of a cycle graph. Refer to Graph Constructors for more details.

See also

Graph Constructors

Further information on graph constructors.

Notes

The cycle is conceptually embedded on a line with cyclic boundary conditions. The order of neighbors for any vertex \(v\) is \([v + 1, v - 1]\), where the right neighbor is listed first, followed by the left neighbor.

>>> g = hpw.Cycle(10)
>>> g.neighbors(0)
array([1, 9])
>>> g.neighbors(1)
array([2, 0])
>>> g.neighbors(8)
array([9, 7])
>>> g.neighbors(9)
array([0, 8])

Methods#

All methods are inherited from hiperwalk.IntegerLattice.