Defined in word-graph-view.hpp.
This class provides a wrapper around WordGraph to allow a non-owning view over a specified range of WordGraph nodes.
| Node | the type of the nodes in the word graph, must be an unsigned integer type. |
Public Types | |
| using | const_iterator_nodes |
| The type of an iterator pointing to the nodes of the word graph view. | |
| using | const_iterator_targets |
| The type of an iterator pointing to the targets of a node. | |
| using | const_reverse_iterator_nodes |
| The type of a reverse iterator pointing to the nodes of a word graph view. | |
| using | label_type = Node |
| The type of edge labels in a word graph. | |
| using | node_type = Node |
| The type of nodes in a word graph. | |
| using | size_type = std::size_t |
| Unsigned integer type. | |
Public Member Functions | |
| WordGraphView () | |
| Default constructor. | |
| WordGraphView (WordGraph< Node > const &graph) | |
| Construct from a WordGraph. | |
| WordGraphView (WordGraph< Node > const &graph, size_type start, size_type end) | |
| Construct from a WordGraph and range of nodes. | |
| WordGraphView (WordGraphView< Node > &&)=default | |
| Default move constructor. | |
| WordGraphView (WordGraphView< Node > const &)=default | |
| Default copy constructor. | |
| const_iterator_nodes | cbegin_nodes () const |
| Returns a random access iterator pointing at the first node of the word graph. | |
| const_iterator_nodes | cbegin_nodes_no_checks () const noexcept |
| Returns a random access iterator pointing at the first node of the word graph. | |
| auto | cbegin_targets (node_type source) const |
Returns a random access iterator pointing at the target of the edge with label 0 incident to a given node. | |
| auto | cbegin_targets_no_checks (node_type source) const noexcept |
Returns a random access iterator pointing at the target of the edge with label 0 incident to a given node. | |
| const_iterator_nodes | cend_nodes () const |
| Returns a random access iterator pointing one past the last node of the range of this word graph view. | |
| const_iterator_nodes | cend_nodes_no_checks () const noexcept |
| Returns a random access iterator pointing one past the last node of the range of this word graph view. | |
| auto | cend_targets (node_type source) const |
Returns a random access iterator pointing one beyond the target of the edge with label out_degree() - 1 incident to a given node. | |
| auto | cend_targets_no_checks (node_type source) const noexcept |
Returns a random access iterator pointing one beyond the target of the edge with label out_degree() - 1 incident to a given node. | |
| node_type | end_node () const noexcept |
| The index in the underlying graph of one beyond the final node in the view. | |
| WordGraphView & | end_node (node_type end) |
| Set the index in the underlying graph of one beyond the last node in the view. | |
| WordGraphView & | end_node_no_checks (node_type end) noexcept |
| Set the index in the underlying graph of one beyond the last node in the view. | |
| bool | equal_to_no_checks (WordGraphView const &that) const |
| Compares two word graph views to see if they are equal. | |
| WordGraphView & | init () |
| Re-initialize the view as if it had been default constructed. | |
| WordGraphView & | init (WordGraph< Node > const &graph) |
Re-initialize the view to be a view over graph. | |
| WordGraphView & | init (WordGraph< Node > const &graph, size_type start, size_type end) |
Re-initialize the view to be a view over graph over the range start to end. | |
| auto | labels () const |
| Returns a range object containing all labels of edges in a word graph. | |
| auto | labels_and_targets (node_type source) const |
| Returns a range object containing pairs consisting of edge labels and target nodes. | |
| auto | labels_and_targets_no_checks (node_type source) const noexcept |
| Returns a range object containing pairs consisting of edge labels and target nodes. | |
| auto | labels_no_checks () const noexcept |
| Returns a range object containing all labels of edges in a word graph. | |
| std::pair< label_type, node_type > | next_label_and_target (node_type s, label_type a) const |
| Get the next target of an edge incident to a given node that doesn't equal UNDEFINED. | |
| std::pair< label_type, node_type > | next_label_and_target_no_checks (node_type s, label_type a) const |
| Get the next target of an edge incident to a given node that doesn't equal UNDEFINED. | |
| auto | nodes () const |
| Returns a range object containing all nodes in a word graph. | |
| auto | nodes_no_checks () const noexcept |
| Returns a range object containing all nodes in a word graph. | |
| bool | not_equal_to_no_checks (WordGraphView const &that) const |
| Compares two word graph views to see if they are not equal. | |
| size_type | number_of_edges () const |
| The number of edges in the underlying graph. | |
| size_type | number_of_edges_no_checks () const noexcept |
| The number of edges in the underlying graph. | |
| size_type | number_of_nodes () const |
| The number of nodes that this view ranges over. | |
| size_type | number_of_nodes_no_checks () const noexcept |
| The number of nodes that this view ranges over. | |
| bool | operator!= (WordGraphView const &that) const |
| Compares two word graph views to see if they are not equal. | |
| WordGraphView & | operator= (WordGraphView< Node > &&)=default |
| Default move assignment. | |
| WordGraphView & | operator= (WordGraphView< Node > const &)=default |
| Default copy assignment. | |
| bool | operator== (WordGraphView const &that) const |
| Compares two word graph views to see if they are equal. | |
| size_type | out_degree () const |
| Returns the out degree. | |
| size_type | out_degree_no_checks () const noexcept |
| Returns the out degree. | |
| WordGraphView & | reshape (node_type start, node_type end) |
| Reshape this view over the same graph. | |
| WordGraphView & | reshape_no_checks (node_type start, node_type end) |
| Reshape this view over the same graph. | |
| node_type | start_node () const noexcept |
| The index in the underlying graph of the first node in the view. | |
| WordGraphView & | start_node (node_type start) |
| Set the index in the underlying graph of the first node in the view. | |
| WordGraphView & | start_node_no_checks (node_type start) noexcept |
| Set the index in the underlying graph of the first node in the view. | |
| node_type | target (node_type source, label_type a) const |
| Get the target of the edge with given source node and label. | |
| node_type | target_no_checks (node_type source, label_type a) const |
| Get the target of the edge with given source node and label. | |
| auto | targets (node_type source) const |
| Returns a range object containing all the targets of edges with a given source. | |
| auto | targets_no_checks (node_type source) const noexcept |
| Returns a range object containing all the targets of edges with a given source. | |
| void | throw_if_any_target_out_of_bounds () const |
| Throws if the target of any edge is out of bounds. | |
| template<typename Iterator> | |
| void | throw_if_any_target_out_of_bounds (Iterator first, Iterator last) const |
| Throws if the target of any edge with source in a given range is out of bounds. | |
| void | throw_if_invalid_range () const |
Throws if the range specified by [start_node(), end_node()] is invalid. | |
| void | throw_if_invalid_view () const |
Throws if the this is in an invalid state. | |
| template<typename Iterator> | |
| void | throw_if_label_out_of_bounds (Iterator first, Iterator last) const |
| Throws if range contains labels that are out of bounds. | |
| void | throw_if_label_out_of_bounds (std::vector< word_type > const &rules) const |
| Throws if any of the labels in vector of words is out of bounds. | |
| void | throw_if_label_out_of_bounds (typename WordGraph< Node >::label_type a) const |
| Throws if a label is out of bounds. | |
| void | throw_if_label_out_of_bounds (word_type const &word) const |
| Throws if word contains labels that are out of bounds. | |
| template<typename Iterator1, typename Iterator2> | |
| void | throw_if_node_out_of_bounds (Iterator1 first, Iterator2 last) const |
| Throws if any node in a range is out of bounds. | |
| template<typename Node2> | |
| void | throw_if_node_out_of_bounds (Node2 n) const |
| Throws if a node is out of bounds. | |
| WordGraph< Node > const * | word_graph () const noexcept |
| Returns a const pointer to the underlying WordGraph. | |
| using const_iterator_nodes |
| using const_iterator_targets |
| using const_reverse_iterator_nodes |
|
inline |
This function is used to construct a WordGraphView from a WordGraph over the range of nodes from start to end.
| graph | underlying WordGraph object. |
| start | the first node in the range. |
| end | one beyond the last node in the range. |
|
inlineexplicit |
This function is used to construct a WordGraphView from a WordGraph over all of the nodes in graph.
| graph | underlying WordGraph object. |
|
inline |
Default constructs an uninitialised WordGraphView.
|
inline |
This function returns a random access iterator pointing at the first in the range of this word graph view.
| LibsemigroupsException | if this is in an invalid state. |
|
inlinenoexcept |
This function returns a random access iterator pointing at the first in the range of this word graph view.
noexcept and is guaranteed never to throw.
|
inlinenodiscard |
This function returns a random access iterator pointing at the target of the edge with label 0 incident to the source node source. This target might equal UNDEFINED.
| source | the source node in the word graph. |
| LibsemigroupsException | if source is out of range (i.e. greater than or equal to number_of_nodes), or if if this is in an invalid state. |
|
inlinenodiscardnoexcept |
This function returns a random access iterator pointing at the target of the edge with label 0 incident to the source node source. This target might equal UNDEFINED.
| source | a node in the word graph. |
noexcept and is guaranteed never to throw.
|
inlinenodiscard |
This function returns a random access iterator pointing one beyond the last node in the word graph.
| LibsemigroupsException | if this is in an invalid state. |
|
inlinenodiscardnoexcept |
This function returns a random access iterator pointing one beyond the last node in the word graph.
noexcept and is guaranteed never to throw.
|
inlinenodiscard |
This function returns a random access iterator pointing one beyond the target of the edge with label out_degree() - 1 incident to the source node source. This target might equal UNDEFINED.
| source | a node in the word graph. |
| LibsemigroupsException | if source is out of range (i.e. greater than or equal to number_of_nodes), of if this is in an invalid state. |
|
inlinenodiscardnoexcept |
This function returns a random access iterator pointing one beyond the target of the edge with label out_degree() - 1 incident to the source node source. This target might equal UNDEFINED.
| source | a node in the word graph. |
noexcept and is guaranteed never to throw.
|
inlinenodiscardnoexcept |
noexcept and is guaranteed never to throw.| WordGraphView & end_node | ( | node_type | end | ) |
| end | the new index of one beyond the last node in the view. |
*this.| LibsemigroupsException | if:
|
|
noexcept |
| end | the new index of one beyond the last node in the view. |
*this.noexcept and is guaranteed never to throw.start_node() <= end <= number_of_nodes().
|
nodiscard |
This function compares two views over two (not necessarily the same) word graph objects to see if the views are equal.
| that | the WordGraphView to compare with. |
|
inline |
This function puts a view into the state that it would have been in if it had just been newly default constructed.
This function guarantees not to throw a LibsemigroupsException.
|
inline |
This function puts a view into the state that it would have been in if it had just been newly constructed with the same parameters graph.
| graph | underlying WordGraph object. |
| WordGraphView & init | ( | WordGraph< Node > const & | graph, |
| size_type | start, | ||
| size_type | end ) |
This function puts a view into the state that it would have been in if it had just been newly constructed with the same parameters graph, start and end.
| graph | underlying WordGraph object. |
| start | the first node in the range. |
| end | one beyond the last node in the range. |
*this.
|
inlinenodiscard |
This function returns a range object containing all the labels of edges in a word graph.
| LibsemigroupsException | if the underlying WordGraph is not defined. |
|
inlinenodiscard |
This function returns a range object containing all the edge labels and targets of edges with source source.
| source | the source node. |
| LibsemigroupsException | if source is out of bounds, or if this is in an invalid state. |
|
inlinenodiscardnoexcept |
This function returns a range object containing all the edge labels and targets of edges with source source.
| source | the source node. |
noexcept and is guaranteed never to throw.source is a valid node of the word graph (i.e. it is not greater than or equal to number_of_nodes).
|
inlinenodiscardnoexcept |
This function returns a range object containing all the labels of edges in a word graph.
| This | function is noexcept and is guaranteed never to throw. |
|
nodiscard |
This function returns the next target of an edge with label greater than or equal to a that is incident to the node s.
If target(s, b) equals UNDEFINED for every value b in the range \([a, n)\), where \(n\) is the return value of out_degree() then x.first and x.second equal UNDEFINED.
| s | the node. |
| a | the label. |
x where:x.first is adjacent to s via an edge labelled x.second; andx.second is the minimum value in the range \([a, n)\) such that target(s, x.second) is not equal to UNDEFINED where \(n\) is the return value of out_degree(); If no such value exists, then {UNDEFINED, UNDEFINED} is returned.| LibsemigroupsException | if:
|
|
nodiscard |
This function returns the next target of an edge with label greater than or equal to a that is incident to the node s.
If target(s, b) equals UNDEFINED for every value b in the range \([a, n)\), where \(n\) is the return value of out_degree() then x.first and x.second equal UNDEFINED.
| s | the node. |
| a | the label. |
x where:x.first is adjacent to s via an edge labelled x.second; andx.second is the minimum value in the range \([a, n)\) such that target(s, x.second) is not equal to UNDEFINED where \(n\) is the return value of out_degree(); If no such value exists, then {UNDEFINED, UNDEFINED} is returned.s is a valid node of the word graph (i.e. it is not greater than or equal to number_of_nodes).
|
inlinenodiscard |
This function returns a range object containing all the nodes in a word graph view
| LibsemigroupsException | if this is in an invalid state. |
|
inlinenodiscardnoexcept |
This function returns a range object containing all the nodes in a word graph view
noexcept and is guaranteed never to throw.
|
inlinenodiscard |
This operator compares two views over two (not necessarily the same) word graph objects to see if the views are not equal.
| that | the WordGraphView to compare with. |
==.
|
inlinenodiscard |
| LibsemigroupsException | if this is in an invalid state. |
number_of_nodes() * out_degree()
|
nodiscardnoexcept |
noexcept and is guaranteed never to throw.number_of_nodes() * out_degree()
|
inlinenodiscard |
| LibsemigroupsException | if this is in an invalid state. |
|
inlinenodiscardnoexcept |
noexcept and is guaranteed never to throw.
|
inlinenodiscard |
This operator compares two views over two (not necessarily the same) word graph objects to see if the views are not equal.
| that | the WordGraphView to compare with. |
==.| LibsemigroupsException | if either this or that are in invalid states. |
|
nodiscard |
This operator compares two views over two (not necessarily the same) word graph objects to see if the views are equal.
| that | the WordGraphView to compare with. |
| LibsemigroupsException | if either this or that are in invalid states. |
|
inlinenodiscard |
This function returns the number of edge labels in the word graph.
size_type.| LibsemigroupsException | if the underlying WordGraph is not defined. |
|
inlinenodiscardnoexcept |
This function returns the number of edge labels in the word graph.
size_type.| This | function is noexcept and is guaranteed never to throw. |
|
inline |
This function is used to reshape this to be a view over the range from start to end.
| start | the first node in the range. |
| end | one beyond the last node in the range. |
*this.| LibsemigroupsException | if:
|
| WordGraphView & reshape_no_checks | ( | node_type | start, |
| node_type | end ) |
This function is used to reshape this to be a view over the range from start to end.
| start | the first node in the range. |
| end | one beyond the last node in the range. |
*this.start is less than or equal to end, and that both values are in the range [0, number_of_nodes()]
|
inlinenodiscardnoexcept |
noexcept and is guaranteed never to throw.| WordGraphView & start_node | ( | node_type | start | ) |
| start | the new index of the first node in the view. |
*this.| LibsemigroupsException | if:
|
|
inlinenoexcept |
| start | the new index of the first node in the view. |
*this.noexcept and is guaranteed never to throw.start is less than or equal to end_node().
|
nodiscard |
This function returns the target of the edge with source node source and label a.
| source | the node. |
| a | the label. |
source via the edge labelled a, or UNDEFINED; both are values of type node_type.| LibsemigroupsException | if source or a is not valid, or if this is in an invalid state. |
|
inlinenodiscard |
This function returns the target of the edge with source node source and label a.
| source | the node. |
| a | the label. |
source via the edge labelled a, or UNDEFINED; both are values of type node_type.| This | function guarantees not to throw a LibsemigroupsException. |
|
inlinenodiscard |
This function returns a range object containing all the targets of edges with source source.
| source | the source node. |
| LibsemigroupsException | if source is out of range (i.e. it is greater than or equal to number_of_nodes), or if this is in an invalid state. |
|
inlinenodiscardnoexcept |
This function returns a range object containing all the targets of edges with source source.
| source | the source node. |
noexcept and is guaranteed never to throw.source is a valid node of the word graph (i.e. it is not greater than or equal to number_of_nodes).
|
inline |
This function throws if any target of any edge is out of bounds (i.e. is greater than or equal to number_of_nodes, and not equal to UNDEFINED).
| LibsemigroupsException | if any target of any edge is greater than or equal to number_of_nodes and not equal to UNDEFINED. |
| void throw_if_any_target_out_of_bounds | ( | Iterator | first, |
| Iterator | last ) const |
This function throws if any target of any edge whose source is in the range defined by first and last is out of bounds (i.e. is greater than or equal to number_of_nodes, and not equal to UNDEFINED).
| Iterator | the type of the 2nd and 3rd arguments. |
| first | iterator pointing at the first node to check. |
| last | iterator pointing one beyond the last node to check. |
| LibsemigroupsException | if any target of any edge with source in the range first to last is greater than or equal to number_of_nodes and not equal to UNDEFINED. |
| LibsemigroupsException | if any node in the range first to last is out of bounds. |
|
inline |
This function throws if:
| LibsemigroupsException | if any the range is invalid. |
|
inline |
This function throws if:
[start_node(), end_node()] is invalid.| LibsemigroupsException | if any this is invalid. |
|
inline |
This function throws if any of the letters in the word defined by first and last is out of bounds, i.e. if they are greater than or equal to out_degree.
| Iterator | the type of the arguments first and last. |
| first | iterator pointing at the first letter to check. |
| last | iterator pointing one beyond the last letter to check. |
| LibsemigroupsException | if any value in the word defined by first and last is out of bounds. |
|
inline |
This function throws if any of the letters in any of the words in rules are out of bounds, i.e. if they are greater than or equal to out_degree.
| rules | the vector of words to check. |
| LibsemigroupsException | if any value in any of the words in rules are out of bounds. |
| void throw_if_label_out_of_bounds | ( | typename WordGraph< Node >::label_type | a | ) | const |
This function throws if the label a is out of bounds, i.e. it is greater than or equal to out_degree.
| a | the label to check. |
| LibsemigroupsException | if the label a is out of bounds. |
|
inline |
This function throws if any of the letters in word are out of bounds, i.e. if they are greater than or equal to out_degree.
| word | the word to check. |
| LibsemigroupsException | if any value in word is out of bounds. |
|
inline |
This function throws if any node in the range from first to last is out of bounds i.e. if they are greater than or equal to number_of_nodes.
| Iterator | the type of the parameters first and last. |
| first | an iterator pointing at the first node to check. |
| last | an iterator pointing one beyond the last node to check. |
| LibsemigroupsException | if any node in the range first to last is out of bounds. |
| void throw_if_node_out_of_bounds | ( | Node2 | n | ) | const |
This function throws if the node n is out of bounds i.e. if it is greater than or equal to number_of_nodes.
| Node2 | the type of the node n. |
| n | the node to check. |
| LibsemigroupsException | if n is out of bounds. |
|
inlinenodiscardnoexcept |