|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
#include <LCA.H>
Public Types | |
| using | Node = typename GT::Node |
| using | Arc = typename GT::Arc |
Public Member Functions | |
| Rooted_Tree_Data (const GT &g, Node *root, SA sa=SA()) | |
| Rooted_Tree_Data (const Rooted_Tree_Data &other)=default | |
| Copy the topology of another tree. | |
| Rooted_Tree_Data (Rooted_Tree_Data &&other) noexcept(std::is_nothrow_move_constructible_v< SA >) | |
| Take the topology of another tree, which is left empty. | |
| Rooted_Tree_Data & | operator= (const Rooted_Tree_Data &other)=default |
| Copy the topology of another tree. | |
| Rooted_Tree_Data & | operator= (Rooted_Tree_Data &&other) noexcept(noexcept(swap(other))) |
| Exchange this topology with another, which is left with the previous topology of this one. | |
| void | swap (Rooted_Tree_Data &other) noexcept(std::is_nothrow_swappable_v< SA >) |
| Exchange in O(1) this topology and another. | |
| size_t | size () const noexcept |
| bool | is_empty () const noexcept |
| Node * | root () const noexcept |
| size_t | root_id () const noexcept |
| const Array< Node * > & | id_to_node () const noexcept |
| const Array< size_t > & | parent () const noexcept |
| const Array< size_t > & | depth () const noexcept |
| const Array< size_t > & | tin () const noexcept |
| const Array< size_t > & | tout () const noexcept |
| const Array< size_t > & | first () const noexcept |
| const Array< size_t > & | euler () const noexcept |
| size_t | euler_size () const noexcept |
| size_t | id_of (const Node *node) const |
| Node * | node_of (const size_t id) const |
| void | validate_id (const size_t id, const char *where) const |
| bool | is_ancestor (const size_t u, const size_t v) const |
Static Public Attributes | |
| static constexpr size_t | NONE = std::numeric_limits<size_t>::max() |
Private Types | |
| using | Pair_Key = std::pair< size_t, size_t > |
Private Member Functions | |
| void | index_nodes () |
| void | build_simple_adjacency () |
| void | build_dfs_data () |
| void | check_id (const size_t id, const char *where) const |
Static Private Member Functions | |
| static Pair_Key | normalize_pair (size_t u, size_t v) noexcept |
Private Attributes | |
| const GT * | graph_ = nullptr |
| SA | sa_ |
| Node * | root_ = nullptr |
| size_t | root_id_ = NONE |
| size_t | n_ = 0 |
| Array< Node * > | id_to_node_ |
| MapOLhash< Node *, size_t > | node_to_id_ |
| Array< Array< size_t > > | adjacency_ |
| Array< size_t > | parent_ |
| Array< size_t > | depth_ |
| Array< size_t > | tin_ |
| Array< size_t > | tout_ |
| Array< size_t > | first_ |
| Array< size_t > | euler_ |
| size_t | euler_size_ = 0 |
| using Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::Arc = typename GT::Arc |
| using Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::Node = typename GT::Node |
|
private |
|
inline |
|
default |
Copy the topology of another tree.
| [in] | other | topology to copy. |
|
inlinenoexcept |
Take the topology of another tree, which is left empty.
The implicit move took the arrays and the map but copied the number of nodes, the root and the size of the Euler tour: the moved-from topology then passed the checks of the ids and read arrays that it no longer had.
| [in,out] | other | topology to move from. |
|
inlineprivate |
Definition at line 255 of file LCA.H.
References Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::adjacency_, ah_domain_error_if, ah_runtime_error_unless, Aleph::Array< T >::create(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::depth_, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::euler_, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::euler_size_, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::first_, Aleph::DynListStack< T >::is_empty(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::n_, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::NONE, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::parent_, Aleph::DynListStack< T >::pop(), Aleph::DynListStack< T >::push(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::root_id_, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::tin_, Aleph::DynListStack< T >::top(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::tout_.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::Rooted_Tree_Data().
|
inlineprivate |
Definition at line 203 of file LCA.H.
References Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::adjacency_, ah_domain_error_if, ah_runtime_error_unless, Aleph::and, GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::graph_, Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::n_, Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::node_to_id_, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::normalize_pair(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::sa_, Aleph::DynMapTree< Key, Data, Tree, Compare >::search(), and Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::search().
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::Rooted_Tree_Data().
|
inlineprivate |
Definition at line 335 of file LCA.H.
References ah_out_of_range_error_if, and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::n_.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::is_ancestor(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::node_of(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::validate_id().
|
inlinenoexcept |
Definition at line 444 of file LCA.H.
References Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::depth_.
Referenced by Aleph::Gen_Euler_RMQ_LCA< GT, SA >::build_rmq(), Aleph::Gen_Binary_Lifting_LCA< GT, SA >::depth_of_id(), Aleph::Gen_Euler_RMQ_LCA< GT, SA >::depth_of_id(), Aleph::Gen_Binary_Lifting_LCA< GT, SA >::distance_id(), Aleph::Gen_Euler_RMQ_LCA< GT, SA >::distance_id(), Aleph::Gen_Binary_Lifting_LCA< GT, SA >::kth_ancestor_id(), and Aleph::Gen_Binary_Lifting_LCA< GT, SA >::lca_id().
|
inlinenoexcept |
Definition at line 460 of file LCA.H.
References Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::euler_.
Referenced by Aleph::Gen_Euler_RMQ_LCA< GT, SA >::build_rmq(), and Aleph::Gen_Euler_RMQ_LCA< GT, SA >::euler_tour().
|
inlinenoexcept |
Definition at line 464 of file LCA.H.
References Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::euler_size_.
Referenced by Aleph::Gen_Euler_RMQ_LCA< GT, SA >::build_rmq(), and Aleph::Gen_Euler_RMQ_LCA< GT, SA >::euler_tour_size().
|
inlinenoexcept |
Definition at line 456 of file LCA.H.
References Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::first_.
Referenced by Aleph::Gen_Euler_RMQ_LCA< GT, SA >::lca_id().
|
inline |
Definition at line 469 of file LCA.H.
References ah_domain_error_if, ah_invalid_argument_if, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::node_to_id_, and Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::search().
Referenced by Aleph::Gen_Binary_Lifting_LCA< GT, SA >::id_of(), and Aleph::Gen_Euler_RMQ_LCA< GT, SA >::id_of().
|
inlinenoexcept |
Definition at line 436 of file LCA.H.
References Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::id_to_node_.
|
inlineprivate |
Definition at line 166 of file LCA.H.
References ah_domain_error_if, ah_runtime_error_unless, Aleph::Array< T >::create(), Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::find(), GraphCommon< GT, Node, Arc >::get_num_nodes(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::graph_, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::id_to_node_, Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::insert(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::n_, Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::node_to_id_, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::root_, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::root_id_, and Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::search().
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::Rooted_Tree_Data().
|
inline |
Definition at line 490 of file LCA.H.
References Aleph::and, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::check_id(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::tin_, and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::tout_.
Referenced by Aleph::Gen_Binary_Lifting_LCA< GT, SA >::is_ancestor_id(), and Aleph::Gen_Euler_RMQ_LCA< GT, SA >::is_ancestor_id().
|
inlinenoexcept |
Definition at line 423 of file LCA.H.
References Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::n_.
Referenced by Aleph::Gen_Binary_Lifting_LCA< GT, SA >::is_empty(), and Aleph::Gen_Euler_RMQ_LCA< GT, SA >::is_empty().
|
inline |
Definition at line 479 of file LCA.H.
References Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::check_id(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::id_to_node_.
Referenced by Aleph::Gen_Binary_Lifting_LCA< GT, SA >::node_of(), and Aleph::Gen_Euler_RMQ_LCA< GT, SA >::node_of().
|
inlinestaticprivatenoexcept |
Definition at line 159 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_simple_adjacency().
|
default |
Copy the topology of another tree.
| [in] | other | topology to copy. |
|
inlinenoexcept |
Exchange this topology with another, which is left with the previous topology of this one.
| [in,out] | other | topology to move from. |
Definition at line 385 of file LCA.H.
References Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::swap().
|
inlinenoexcept |
Definition at line 440 of file LCA.H.
References Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::parent_.
Referenced by Aleph::Gen_Binary_Lifting_LCA< GT, SA >::build_jump_table(), Aleph::Gen_Binary_Lifting_LCA< GT, SA >::lca_id(), Aleph::Gen_Binary_Lifting_LCA< GT, SA >::parent_id(), and Aleph::Gen_Euler_RMQ_LCA< GT, SA >::parent_id().
|
inlinenoexcept |
Definition at line 427 of file LCA.H.
References Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::root_.
Referenced by Aleph::Gen_Binary_Lifting_LCA< GT, SA >::root(), and Aleph::Gen_Euler_RMQ_LCA< GT, SA >::root().
|
inlinenoexcept |
Definition at line 431 of file LCA.H.
References Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::root_id_.
Referenced by Aleph::Gen_Binary_Lifting_LCA< GT, SA >::root_id(), and Aleph::Gen_Euler_RMQ_LCA< GT, SA >::root_id().
|
inlinenoexcept |
Definition at line 419 of file LCA.H.
References Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::n_.
Referenced by Aleph::Gen_Binary_Lifting_LCA< GT, SA >::n(), Aleph::Gen_Binary_Lifting_LCA< GT, SA >::size(), and Aleph::Gen_Euler_RMQ_LCA< GT, SA >::size().
|
inlinenoexcept |
Exchange in O(1) this topology and another.
| [in,out] | other | topology to exchange with. |
| what | swapping the filters throws. They are exchanged first, so that then nothing is exchanged: both topologies are left as they were, if that swap left its arguments as they were. |
Definition at line 397 of file LCA.H.
References Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::adjacency_, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::depth_, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::euler_, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::euler_size_, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::first_, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::graph_, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::id_to_node_, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::n_, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::node_to_id_, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::parent_, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::root_, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::root_id_, Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::sa_, Aleph::Array< T >::swap(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::swap(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::tin_, and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::tout_.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::operator=(), Aleph::Gen_Binary_Lifting_LCA< GT, SA >::swap(), Aleph::Gen_Euler_RMQ_LCA< GT, SA >::swap(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::swap().
|
inlinenoexcept |
Definition at line 448 of file LCA.H.
References Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::tin_.
|
inlinenoexcept |
Definition at line 452 of file LCA.H.
References Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::tout_.
|
inline |
Definition at line 485 of file LCA.H.
References Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::check_id().
Referenced by Aleph::Gen_Binary_Lifting_LCA< GT, SA >::depth_of_id(), Aleph::Gen_Euler_RMQ_LCA< GT, SA >::depth_of_id(), Aleph::Gen_Binary_Lifting_LCA< GT, SA >::kth_ancestor_id(), Aleph::Gen_Euler_RMQ_LCA< GT, SA >::lca_id(), Aleph::Gen_Binary_Lifting_LCA< GT, SA >::lca_id(), Aleph::Gen_Binary_Lifting_LCA< GT, SA >::parent_id(), and Aleph::Gen_Euler_RMQ_LCA< GT, SA >::parent_id().
|
private |
Definition at line 150 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_dfs_data(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_simple_adjacency(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::swap().
|
private |
Definition at line 152 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_dfs_data(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::depth(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::swap().
|
private |
Definition at line 156 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_dfs_data(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::euler(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::swap().
|
private |
Definition at line 157 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_dfs_data(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::euler_size(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::swap().
|
private |
Definition at line 155 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_dfs_data(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::first(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::swap().
|
private |
Definition at line 140 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_simple_adjacency(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::index_nodes(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::swap().
|
private |
|
private |
Definition at line 145 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_dfs_data(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_simple_adjacency(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::check_id(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::index_nodes(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::is_empty(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::size(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::swap().
|
private |
Definition at line 148 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_simple_adjacency(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::id_of(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::index_nodes(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::swap().
|
staticconstexpr |
Definition at line 135 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_dfs_data().
|
private |
Definition at line 151 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_dfs_data(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::parent(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::swap().
|
private |
Definition at line 142 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::index_nodes(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::root(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::swap().
|
private |
|
private |
Definition at line 141 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_simple_adjacency(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::swap().
|
private |
|
private |