hiperwalk.Multigraph.vertex_number#

Multigraph.vertex_number(vertex)#

Return the numerical label of a vertex based on its representation.

This method is designed to handle graphs where vertices might have multiple representations, such as coordinates in a grid. In cases of arbitrary graphs, this function will return the input itself if it is a valid representation.

Parameters:
vertexint

The vertex in any valid representation. For arbitrary graphs, only the vertex’s label is accepted.

Returns:
int

The numerical label of the vertex.

Raises:
ValueError

If the vertex is not a valid representation.

Notes

Implementing this function is beneficial for arbitrary graphs as it simplifies the implementation of some quantum walk methods.