|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
#include <HLD.H>
Public Types | |
| using | Node = typename GT::Node |
| using | Arc = typename GT::Arc |
Public Member Functions | |
| HLD_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 > & | subtree_size () const noexcept |
| const Array< size_t > & | pos () const noexcept |
| const Array< size_t > & | chain_head () const noexcept |
| const Array< size_t > & | tin () const noexcept |
| const Array< size_t > & | tout () const noexcept |
| size_t | num_chains () 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 |
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 | compute_sizes_and_parents () |
| void | reorder_adjacency_heavy_first () |
| void | compute_hld_positions () |
| 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 > | subtree_size_ |
| Array< size_t > | pos_ |
| Array< size_t > | chain_head_ |
| Array< size_t > | tin_ |
| Array< size_t > | tout_ |
| size_t | num_chains_ = 0 |
|
private |
|
inline |
Definition at line 450 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::build_simple_adjacency(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_hld_positions(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_sizes_and_parents(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::index_nodes(), and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::reorder_adjacency_heavy_first().
|
inlineprivate |
Definition at line 198 of file HLD.H.
References Aleph::hld_detail::HLD_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::hld_detail::HLD_Tree_Data< GT, SA >::graph_, Aleph::hld_detail::HLD_Tree_Data< GT, SA >::n_, Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::node_to_id_, Aleph::hld_detail::HLD_Tree_Data< GT, SA >::normalize_pair(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::sa_, and Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::search().
Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::HLD_Tree_Data().
|
inlinenoexcept |
Definition at line 470 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::chain_head_.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::chain_head_array(), Aleph::Gen_HLD< GT, T, Op, SA >::chain_head_id(), Aleph::Gen_HLD< GT, T, Op, SA >::lca_id(), Aleph::Gen_HLD< GT, T, Op, SA >::path_query_edges_id(), and Aleph::Gen_HLD< GT, T, Op, SA >::path_query_id().
|
inlineprivate |
Definition at line 443 of file HLD.H.
References ah_out_of_range_error_if, Aleph::divide_and_conquer_partition_dp(), and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::n_.
Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::node_of(), and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::validate_id().
|
inlineprivate |
Definition at line 363 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::adjacency_, Aleph::and, Aleph::hld_detail::HLD_Tree_Data< GT, SA >::chain_head_, Aleph::Array< T >::create(), Aleph::divide_and_conquer_partition_dp(), Aleph::DynListStack< T >::is_empty(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::n_, Aleph::hld_detail::HLD_Tree_Data< GT, SA >::NONE, Aleph::hld_detail::HLD_Tree_Data< GT, SA >::num_chains_, Aleph::DynListStack< T >::pop(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::pos_, Aleph::DynListStack< T >::push(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::root_id_, Aleph::hld_detail::HLD_Tree_Data< GT, SA >::tin_, Aleph::DynListStack< T >::top(), and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::tout_.
Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::HLD_Tree_Data().
|
inlineprivate |
Definition at line 252 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::adjacency_, ah_domain_error_if, Aleph::Array< T >::create(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::depth_, Aleph::divide_and_conquer_partition_dp(), Aleph::DynListStack< T >::is_empty(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::n_, Aleph::hld_detail::HLD_Tree_Data< GT, SA >::NONE, Aleph::hld_detail::HLD_Tree_Data< GT, SA >::parent_, Aleph::DynListStack< T >::pop(), Aleph::DynListStack< T >::push(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::root_id_, Aleph::hld_detail::HLD_Tree_Data< GT, SA >::subtree_size_, and Aleph::DynListStack< T >::top().
Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::HLD_Tree_Data().
|
inlinenoexcept |
Definition at line 467 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::depth_.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::depth_array(), Aleph::Gen_HLD< GT, T, Op, SA >::depth_of_id(), Aleph::Gen_HLD< GT, T, Op, SA >::distance_id(), Aleph::Gen_HLD< GT, T, Op, SA >::lca_id(), Aleph::Gen_HLD< GT, T, Op, SA >::path_query_edges_id(), and Aleph::Gen_HLD< GT, T, Op, SA >::path_query_id().
|
inline |
Definition at line 475 of file HLD.H.
References ah_domain_error_if, ah_invalid_argument_if, Aleph::hld_detail::HLD_Tree_Data< GT, SA >::node_to_id_, and Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::search().
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::id_of().
|
inlinenoexcept |
Definition at line 465 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::id_to_node_.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::build_segment_tree().
|
inlineprivate |
Definition at line 160 of file HLD.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::hld_detail::HLD_Tree_Data< GT, SA >::graph_, Aleph::hld_detail::HLD_Tree_Data< GT, SA >::id_to_node_, Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::insert(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::n_, Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::node_to_id_, Aleph::hld_detail::HLD_Tree_Data< GT, SA >::root_, Aleph::hld_detail::HLD_Tree_Data< GT, SA >::root_id_, and Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::search().
Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::HLD_Tree_Data().
|
inlinenoexcept |
Definition at line 461 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::n_.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::is_empty().
|
inline |
Definition at line 487 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::check_id(), and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::id_to_node_.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::node_of().
|
inlinestaticprivatenoexcept |
Definition at line 153 of file HLD.H.
Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::build_simple_adjacency().
|
inlinenoexcept |
Definition at line 473 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::num_chains_.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::num_chains().
|
inlinenoexcept |
Definition at line 466 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::parent_.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::lca_id(), Aleph::Gen_HLD< GT, T, Op, SA >::parent_array(), Aleph::Gen_HLD< GT, T, Op, SA >::parent_id(), Aleph::Gen_HLD< GT, T, Op, SA >::path_query_edges_id(), and Aleph::Gen_HLD< GT, T, Op, SA >::path_query_id().
|
inlinenoexcept |
Definition at line 469 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::pos_.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::build_segment_tree(), Aleph::Gen_HLD< GT, T, Op, SA >::get_value_at_id(), Aleph::Gen_HLD< GT, T, Op, SA >::path_query_edges_id(), Aleph::Gen_HLD< GT, T, Op, SA >::path_query_id(), Aleph::Gen_HLD< GT, T, Op, SA >::point_update_id(), Aleph::Gen_HLD< GT, T, Op, SA >::position(), Aleph::Gen_HLD< GT, T, Op, SA >::position_array(), and Aleph::Gen_HLD< GT, T, Op, SA >::subtree_query_id().
|
inlineprivate |
Definition at line 322 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::adjacency_, Aleph::divide_and_conquer_partition_dp(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::n_, Aleph::hld_detail::HLD_Tree_Data< GT, SA >::NONE, Aleph::hld_detail::HLD_Tree_Data< GT, SA >::parent_, and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::subtree_size_.
Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::HLD_Tree_Data().
|
inlinenoexcept |
Definition at line 462 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::root_.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::root().
|
inlinenoexcept |
Definition at line 463 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::root_id_.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::root_id().
|
inlinenoexcept |
Definition at line 460 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::n_.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::n(), and Aleph::Gen_HLD< GT, T, Op, SA >::size().
|
inlinenoexcept |
Definition at line 468 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::subtree_size_.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::subtree_query_id(), Aleph::Gen_HLD< GT, T, Op, SA >::subtree_size_array(), and Aleph::Gen_HLD< GT, T, Op, SA >::subtree_size_of_id().
|
inlinenoexcept |
Definition at line 471 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::tin_.
|
inlinenoexcept |
Definition at line 472 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::tout_.
|
inline |
Definition at line 493 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::check_id(), and Aleph::divide_and_conquer_partition_dp().
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::chain_head_id(), Aleph::Gen_HLD< GT, T, Op, SA >::depth_of_id(), Aleph::Gen_HLD< GT, T, Op, SA >::get_value_at_id(), Aleph::Gen_HLD< GT, T, Op, SA >::lca_id(), Aleph::Gen_HLD< GT, T, Op, SA >::parent_id(), Aleph::Gen_HLD< GT, T, Op, SA >::path_query_edges_id(), Aleph::Gen_HLD< GT, T, Op, SA >::path_query_id(), Aleph::Gen_HLD< GT, T, Op, SA >::point_update_id(), Aleph::Gen_HLD< GT, T, Op, SA >::position(), Aleph::Gen_HLD< GT, T, Op, SA >::subtree_query_id(), and Aleph::Gen_HLD< GT, T, Op, SA >::subtree_size_of_id().
|
private |
Definition at line 140 of file HLD.H.
Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::build_simple_adjacency(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_hld_positions(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_sizes_and_parents(), and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::reorder_adjacency_heavy_first().
|
private |
Definition at line 147 of file HLD.H.
Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::chain_head(), and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_hld_positions().
|
private |
Definition at line 142 of file HLD.H.
Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_sizes_and_parents(), and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::depth().
Definition at line 130 of file HLD.H.
Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::build_simple_adjacency(), and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::index_nodes().
|
private |
Definition at line 137 of file HLD.H.
Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::id_to_node(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::index_nodes(), and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::node_of().
Definition at line 135 of file HLD.H.
Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::build_simple_adjacency(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::check_id(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_hld_positions(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_sizes_and_parents(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::index_nodes(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::is_empty(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::reorder_adjacency_heavy_first(), and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::size().
|
private |
Definition at line 138 of file HLD.H.
Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::build_simple_adjacency(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::id_of(), and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::index_nodes().
|
staticconstexpr |
|
private |
Definition at line 151 of file HLD.H.
Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_hld_positions(), and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::num_chains().
|
private |
Definition at line 141 of file HLD.H.
Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_sizes_and_parents(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::parent(), and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::reorder_adjacency_heavy_first().
|
private |
Definition at line 146 of file HLD.H.
Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_hld_positions(), and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::pos().
|
private |
Definition at line 132 of file HLD.H.
Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::index_nodes(), and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::root().
|
private |
Definition at line 133 of file HLD.H.
Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_hld_positions(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_sizes_and_parents(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::index_nodes(), and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::root_id().
Definition at line 131 of file HLD.H.
Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::build_simple_adjacency().
|
private |
Definition at line 143 of file HLD.H.
Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_sizes_and_parents(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::reorder_adjacency_heavy_first(), and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::subtree_size().
|
private |
Definition at line 148 of file HLD.H.
Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_hld_positions(), and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::tin().
|
private |
Definition at line 149 of file HLD.H.
Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_hld_positions(), and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::tout().