unsafe_next_neighbor

std::pair<node_type, label_type> libsemigroups::ActionDigraph::unsafe_next_neighbor(node_type v, label_type i) const

Get the next neighbor of a node that doesn’t equal libsemigroups::UNDEFINED.

This function guarantees not to throw a

LibsemigroupsException.
Return

Returns a std::pair x where:

  1. x.second is the minimum value in the range \([i, //! out_degree())\) such that neighbor(v, x.second) is not equal to libsemigroups::UNDEFINED; and

  2. x.first is adjacent to v via an edge labelled x.second; If neighbor(v, i) equals libsemigroups::UNDEFINED for every value in the range \([i, out_degree())\), then x.first and x.second equal libsemigroups::UNDEFINED.

Complexity

At worst \(O(n)\) where \(n\) equals out_degree().

Parameters
  • v: the node

  • i: the label

See

next_neighbor.

Warning

This function is unsafe because it is not verified that the parameter v represents a node of this.