hiperwalk.Line#

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

Finite line graph (path graph) constructor.

Parameters:
num_vertint

The number of vertices on the line.

multiedges, weights: scipy.sparse.csr_array, default=None

See Graph Constructors.

copybool, default=False

See Graph Constructors.

Returns:
hiperwalk.Graph

See Graph Constructors for details.

Notes

The order of neighbors is the neighbor to the right first, followed by the neighbor to the left. In other words, for any vertex \(v\), the neighbors are given in the order \([v + 1, v - 1]\).

>>> g = hpw.Line(10)
>>> list(g.neighbors(0)) # 0 and 9 are not adjacent
[1]
>>> list(g.neighbors(1))
[2, 0]
>>> list(g.neighbors(8))
[9, 7]
>>> list(g.neighbors(9)) # 0 and 9 are not adjacent
[8]

Methods#

All methods are inherited from hiperwalk.IntegerLattice.