|
Aleph-w 3.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()) | |
| 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 |
|
private |
|
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::divide_and_conquer_partition_dp(), 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 201 of file LCA.H.
References Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::adjacency_, ah_domain_error_if, ah_runtime_error_unless, Aleph::and, Aleph::divide_and_conquer_partition_dp(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::graph_, 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_, 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 337 of file LCA.H.
References ah_out_of_range_error_if, Aleph::divide_and_conquer_partition_dp(), 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 359 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 363 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 364 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 362 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 366 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 357 of file LCA.H.
References Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::id_to_node_.
|
inlineprivate |
Definition at line 163 of file LCA.H.
References ah_domain_error_if, ah_runtime_error_unless, Aleph::Array< T >::create(), Aleph::divide_and_conquer_partition_dp(), 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 389 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 353 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 378 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 156 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_simple_adjacency().
|
inlinenoexcept |
Definition at line 358 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 354 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 355 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 352 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 |
Definition at line 360 of file LCA.H.
References Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::tin_.
|
inlinenoexcept |
Definition at line 361 of file LCA.H.
References Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::tout_.
|
inline |
Definition at line 384 of file LCA.H.
References Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::check_id(), and Aleph::divide_and_conquer_partition_dp().
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 147 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_dfs_data(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_simple_adjacency().
|
private |
Definition at line 149 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_dfs_data(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::depth().
|
private |
Definition at line 153 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_dfs_data(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::euler().
|
private |
Definition at line 154 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_dfs_data(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::euler_size().
|
private |
Definition at line 152 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_dfs_data(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::first().
Definition at line 137 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 >::index_nodes().
|
private |
Definition at line 144 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::id_to_node(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::index_nodes(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::node_of().
Definition at line 142 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(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::size().
|
private |
Definition at line 145 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(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::index_nodes().
|
staticconstexpr |
Definition at line 132 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_dfs_data().
|
private |
Definition at line 148 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_dfs_data(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::parent().
|
private |
Definition at line 139 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::index_nodes(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::root().
|
private |
Definition at line 140 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 >::index_nodes(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::root_id().
Definition at line 138 of file LCA.H.
Referenced by Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_simple_adjacency().
|
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 >::is_ancestor(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::tin().
|
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 >::is_ancestor(), and Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::tout().