hiperwalk.graph.integer_lattice.vertex_coordinates#
- hiperwalk.graph.integer_lattice.vertex_coordinates(self, vertex)[source]#
Return the coordinates of the given vertex.
Given the number of a vertex, return the corresponding coordinates in the integer lattice.
- Returns:
See also
Notes
The vertex number depends on its coordinates and the dimension of the lattice
dim
. If the coordinates of a vertex are(v[0], ..., v[n-1])
, its number isv[n-1] + dim[n-1]*v[n-2] + ... + dim[n-1]*...*dim[1]*v[0]
.Examples
The methods
vertex_coordinates
is the inverse ofvertex_number
, and vice versa.>>> g = hpw.IntegerLattice((3, 3, 3)) >>> tuple(g.vertex_coordinates(0)) (0, 0, 0) >>> g.vertex_number((0, 0, 0)) 0 >>> tuple(g.vertex_coordinates(13)) (1, 1, 1) >>> g.vertex_number((1, 1, 1)) 13