|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Heavy-Light Decomposition with segment tree for path/subtree queries. More...
#include <HLD.H>
Public Types | |
| using | Node = typename GT::Node |
Public Member Functions | |
| template<class NodeValueFn > | |
| Gen_HLD (const GT &g, Node *root, NodeValueFn &&node_value, const T &identity, Op oper=Op(), SA sa=SA()) | |
| Construct HLD from graph, root, and node value functor. | |
| template<class NodeValueFn > | |
| Gen_HLD (const GT &g, NodeValueFn &&node_value, const T &identity, Op oper=Op(), SA sa=SA()) | |
| Construct with first graph node as root. | |
| Gen_HLD (const Gen_HLD &other)=default | |
| Copy the decomposition and the values of another HLD. | |
| Gen_HLD (Gen_HLD &&other)=default | |
| Take the decomposition and the values of another HLD, which is left empty. | |
| Gen_HLD & | operator= (const Gen_HLD &other)=default |
| Copy the decomposition and the values of another HLD. | |
| Gen_HLD & | operator= (Gen_HLD &&other) noexcept(noexcept(swap(other))) |
| Exchange this HLD with another, which is left with the previous tree and values of this one. | |
| void | swap (Gen_HLD &other) noexcept(std::is_nothrow_swappable_v< T > and std::is_nothrow_swappable_v< Op > and std::is_nothrow_swappable_v< SA >) |
| Exchange in O(1) this HLD and another. | |
| size_t | size () const noexcept |
| Total number of nodes in the tree. | |
| bool | is_empty () const noexcept |
| Returns true if the tree has no nodes. | |
| Node * | root () const noexcept |
| Returns the root node. | |
| size_t | root_id () const noexcept |
| Returns the internal ID of the root node. | |
| Node * | node_of (const size_t id) const |
| Map an internal ID back to a Node pointer. | |
| size_t | id_of (const Node *node) const |
| Map a Node pointer to its internal ID. | |
| size_t | position (const size_t id) const |
HLD flat-array position of node id. | |
| size_t | chain_head_id (const size_t id) const |
Head of the chain containing node id. | |
| size_t | depth_of_id (const size_t id) const |
Depth of node id from root. | |
| size_t | depth_of (const Node *node) const |
| Depth of node from root. | |
| size_t | subtree_size_of_id (const size_t id) const |
Subtree size of node id. | |
| size_t | subtree_size_of (const Node *node) const |
| Subtree size of node. | |
| size_t | parent_id (const size_t id) const |
Parent ID of node id, or NONE if root. | |
| Node * | parent_of (const Node *node) const |
Parent of node, or nullptr if root. | |
| size_t | num_chains () const noexcept |
| Number of heavy chains in the decomposition. | |
| T | path_query_id (size_t u, size_t v) const |
| Path query by node IDs in O(log^2 n). | |
| T | path_query (const Node *u, const Node *v) const |
| Path query by node pointers in O(log^2 n). | |
| T | path_query_edges_id (size_t u, size_t v) const |
| Edge-weighted path query by node IDs in O(log^2 n). | |
| T | path_query_edges (const Node *u, const Node *v) const |
| Edge-weighted path query by node pointers. | |
| T | subtree_query_id (const size_t v) const |
| Subtree query by node ID in O(log n). | |
| T | subtree_query (const Node *v) const |
| Subtree query by node pointer in O(log n). | |
| void | point_update_id (const size_t v, const T &new_value) |
Point update by node ID: set value to new_value. | |
| void | point_update (const Node *v, const T &new_value) |
Point update by node pointer: set value to new_value. | |
| size_t | lca_id (size_t u, size_t v) const |
| LCA query by node IDs in O(log n). | |
| Node * | lca (const Node *u, const Node *v) const |
| LCA query by node pointers in O(log n). | |
| size_t | distance_id (const size_t u, const size_t v) const |
| Number of edges between two nodes by IDs in O(log n). | |
| size_t | distance (const Node *u, const Node *v) const |
| Number of edges between two nodes in O(log n). | |
| const Array< size_t > & | position_array () const noexcept |
| Read-only access to the flat-position array. | |
| const Array< size_t > & | chain_head_array () const noexcept |
| Read-only access to the chain-head array. | |
| const Array< size_t > & | depth_array () const noexcept |
| Read-only access to the depth array. | |
| const Array< size_t > & | subtree_size_array () const noexcept |
| Read-only access to the subtree-size array. | |
| const Array< size_t > & | parent_array () const noexcept |
| Read-only access to the parent array. | |
| T | get_value_at_id (const size_t id) const |
Current node value at HLD position pos in the segment tree. | |
| T | get_value (const Node *v) const |
Current node value at node pointer v. | |
Private Types | |
| using | Topology = hld_detail::HLD_Tree_Data< GT, SA > |
Private Member Functions | |
| size_t | n () const noexcept |
| void | ensure_not_empty (const char *where) const |
| template<class NodeValueFn > | |
| void | build_segment_tree (NodeValueFn &&node_value) |
| void | swap_but_topology_storage (Gen_HLD &other) |
Private Attributes | |
| Topology | topology_ |
| T | identity_ |
| Op | op_ |
| Gen_Segment_Tree< T, Op > | seg_ |
Static Private Attributes | |
| static constexpr size_t | NONE = Topology::NONE |
Heavy-Light Decomposition with segment tree for path/subtree queries.
Decomposes a rooted tree into heavy chains and maintains a segment tree over the flattened HLD order. Supports path queries, subtree queries, point updates, LCA computation, and distance queries.
| GT | Graph type (List_Graph, List_SGraph, Array_Graph). |
| T | Value type stored at each node. |
| Op | Associative and commutative binary functor over T. |
| SA | Arc filter type (default: Dft_Show_Arc<GT>). |
| Operation | Time |
|---|---|
| Construction | O(n log n) |
| path_query | O(log^2 n) |
| subtree_query | O(log n) |
| point_update | O(log n) |
| lca | O(log n) |
| distance | O(log n) |
| using Aleph::Gen_HLD< GT, T, Op, SA >::Node = typename GT::Node |
|
private |
|
inline |
Construct HLD from graph, root, and node value functor.
| [in] | g | Tree topology (filtered by sa). |
| [in] | root | Root node pointer (must belong to g). |
| [in] | node_value | Callable Node* -> T providing node values. |
| [in] | identity | Identity element of the monoid (T, Op). |
| [in] | oper | Associative binary functor. |
| [in] | sa | Arc filter. |
| ah_domain_error | if the filtered graph is not a tree. |
Definition at line 677 of file HLD.H.
References Aleph::Gen_HLD< GT, T, Op, SA >::build_segment_tree().
|
inline |
Construct with first graph node as root.
Definition at line 689 of file HLD.H.
References Aleph::Gen_HLD< GT, T, Op, SA >::build_segment_tree().
Copy the decomposition and the values of another HLD.
| [in] | other | HLD to copy. |
Take the decomposition and the values of another HLD, which is left empty.
The topology of the moved-from HLD is empty, so that the HLD never queries the segment tree that the move leaves to it.
| [in,out] | other | HLD to move from. |
|
inlineprivate |
Definition at line 646 of file HLD.H.
References Aleph::Array< T >::create(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::id_to_node(), Aleph::Gen_HLD< GT, T, Op, SA >::identity_, Aleph::Gen_HLD< GT, T, Op, SA >::is_empty(), Aleph::Gen_HLD< GT, T, Op, SA >::n(), Aleph::Gen_HLD< GT, T, Op, SA >::op_, Aleph::hld_detail::HLD_Tree_Data< GT, SA >::pos(), Aleph::Gen_HLD< GT, T, Op, SA >::seg_, and Aleph::Gen_HLD< GT, T, Op, SA >::topology_.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::Gen_HLD(), and Aleph::Gen_HLD< GT, T, Op, SA >::Gen_HLD().
|
inlinenoexcept |
Read-only access to the chain-head array.
chain_head_array()(id) gives the ID of the head of the chain containing node id.
Definition at line 1093 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::chain_head(), and Aleph::Gen_HLD< GT, T, Op, SA >::topology_.
|
inline |
Head of the chain containing node id.
Definition at line 837 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::chain_head(), Aleph::Gen_HLD< GT, T, Op, SA >::topology_, and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::validate_id().
Referenced by TYPED_TEST().
|
inlinenoexcept |
Read-only access to the depth array.
Definition at line 1099 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::depth(), and Aleph::Gen_HLD< GT, T, Op, SA >::topology_.
|
inline |
Depth of node from root.
Definition at line 851 of file HLD.H.
References Aleph::Gen_HLD< GT, T, Op, SA >::depth_of_id(), and Aleph::Gen_HLD< GT, T, Op, SA >::id_of().
Referenced by TYPED_TEST().
|
inline |
Depth of node id from root.
Definition at line 844 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::depth(), Aleph::Gen_HLD< GT, T, Op, SA >::topology_, and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::validate_id().
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::depth_of(), and TYPED_TEST().
|
inline |
Number of edges between two nodes in O(log n).
Definition at line 1070 of file HLD.H.
References Aleph::Gen_HLD< GT, T, Op, SA >::distance_id(), and Aleph::Gen_HLD< GT, T, Op, SA >::id_of().
Referenced by TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().
|
inline |
Number of edges between two nodes by IDs in O(log n).
Definition at line 1062 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::depth(), Aleph::Gen_HLD< GT, T, Op, SA >::lca_id(), and Aleph::Gen_HLD< GT, T, Op, SA >::topology_.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::distance().
|
inlineprivate |
Definition at line 639 of file HLD.H.
References ah_domain_error_if, and Aleph::Gen_HLD< GT, T, Op, SA >::is_empty().
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::lca_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(), and Aleph::Gen_HLD< GT, T, Op, SA >::subtree_query_id().
|
inline |
Current node value at node pointer v.
Definition at line 1124 of file HLD.H.
References Aleph::Gen_HLD< GT, T, Op, SA >::get_value_at_id(), and Aleph::Gen_HLD< GT, T, Op, SA >::id_of().
Referenced by TYPED_TEST().
|
inline |
Current node value at HLD position pos in the segment tree.
Definition at line 1117 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::pos(), Aleph::Gen_HLD< GT, T, Op, SA >::seg_, Aleph::Gen_HLD< GT, T, Op, SA >::topology_, and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::validate_id().
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::get_value().
|
inline |
Map a Node pointer to its internal ID.
Definition at line 824 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::id_of(), and Aleph::Gen_HLD< GT, T, Op, SA >::topology_.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::depth_of(), Aleph::Gen_HLD< GT, T, Op, SA >::distance(), Aleph::Gen_HLD< GT, T, Op, SA >::get_value(), Aleph::Gen_HLD< GT, T, Op, SA >::lca(), Aleph::Gen_HLD< GT, T, Op, SA >::parent_of(), Aleph::Gen_HLD< GT, T, Op, SA >::path_query(), Aleph::Gen_HLD< GT, T, Op, SA >::path_query_edges(), Aleph::Gen_HLD< GT, T, Op, SA >::point_update(), Aleph::Gen_HLD< GT, T, Op, SA >::subtree_query(), Aleph::Gen_HLD< GT, T, Op, SA >::subtree_size_of(), TYPED_TEST(), and TYPED_TEST().
|
inlinenoexcept |
Returns true if the tree has no nodes.
Definition at line 809 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::is_empty(), and Aleph::Gen_HLD< GT, T, Op, SA >::topology_.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::build_segment_tree(), Aleph::Gen_HLD< GT, T, Op, SA >::ensure_not_empty(), and TYPED_TEST().
LCA query by node pointers in O(log n).
Definition at line 1052 of file HLD.H.
References Aleph::Gen_HLD< GT, T, Op, SA >::id_of(), Aleph::Gen_HLD< GT, T, Op, SA >::lca_id(), and Aleph::Gen_HLD< GT, T, Op, SA >::node_of().
Referenced by TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().
|
inline |
LCA query by node IDs in O(log n).
Definition at line 1033 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::chain_head(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::depth(), Aleph::Gen_HLD< GT, T, Op, SA >::ensure_not_empty(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::parent(), Aleph::Gen_HLD< GT, T, Op, SA >::topology_, and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::validate_id().
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::distance_id(), Aleph::Gen_HLD< GT, T, Op, SA >::lca(), and TYPED_TEST().
|
inlineprivatenoexcept |
Definition at line 637 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::size(), and Aleph::Gen_HLD< GT, T, Op, SA >::topology_.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::build_segment_tree().
|
inline |
Map an internal ID back to a Node pointer.
Definition at line 818 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::node_of(), and Aleph::Gen_HLD< GT, T, Op, SA >::topology_.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::lca(), and Aleph::Gen_HLD< GT, T, Op, SA >::parent_of().
|
inlinenoexcept |
Number of heavy chains in the decomposition.
Definition at line 884 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::num_chains(), and Aleph::Gen_HLD< GT, T, Op, SA >::topology_.
Referenced by TYPED_TEST(), and TYPED_TEST().
|
default |
Copy the decomposition and the values of another HLD.
| [in] | other | HLD to copy. |
|
inlinenoexcept |
Exchange this HLD with another, which is left with the previous tree and values of this one.
The implicit assignment left the segment tree to its own move assignment, which exchanged its array but copied its size, and copied the identity: the moved-from HLD then queried the tree that it received with the size of its own.
| [in,out] | other | HLD to move from. |
Definition at line 731 of file HLD.H.
References Aleph::Gen_HLD< GT, T, Op, SA >::swap().
|
inlinenoexcept |
Read-only access to the parent array.
Definition at line 1111 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::parent(), and Aleph::Gen_HLD< GT, T, Op, SA >::topology_.
|
inline |
Parent ID of node id, or NONE if root.
Definition at line 870 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::parent(), Aleph::Gen_HLD< GT, T, Op, SA >::topology_, and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::validate_id().
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::parent_of().
|
inline |
Parent of node, or nullptr if root.
Definition at line 877 of file HLD.H.
References Aleph::Gen_HLD< GT, T, Op, SA >::id_of(), Aleph::Gen_HLD< GT, T, Op, SA >::node_of(), Aleph::Gen_HLD< GT, T, Op, SA >::NONE, and Aleph::Gen_HLD< GT, T, Op, SA >::parent_id().
Referenced by TYPED_TEST().
Path query by node pointers in O(log^2 n).
Definition at line 934 of file HLD.H.
References Aleph::Gen_HLD< GT, T, Op, SA >::id_of(), and Aleph::Gen_HLD< GT, T, Op, SA >::path_query_id().
Referenced by TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().
Edge-weighted path query by node pointers.
Definition at line 976 of file HLD.H.
References Aleph::Gen_HLD< GT, T, Op, SA >::id_of(), and Aleph::Gen_HLD< GT, T, Op, SA >::path_query_edges_id().
Referenced by TYPED_TEST().
|
inline |
Edge-weighted path query by node IDs in O(log^2 n).
Like path_query_id but skips the LCA node value, useful when values represent edges (stored on the child node).
Definition at line 944 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::chain_head(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::depth(), Aleph::Gen_HLD< GT, T, Op, SA >::ensure_not_empty(), Aleph::Gen_HLD< GT, T, Op, SA >::identity_, Aleph::Gen_HLD< GT, T, Op, SA >::op_, Aleph::hld_detail::HLD_Tree_Data< GT, SA >::parent(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::pos(), Aleph::Gen_HLD< GT, T, Op, SA >::seg_, Aleph::Gen_HLD< GT, T, Op, SA >::topology_, and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::validate_id().
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::path_query_edges().
|
inline |
Path query by node IDs in O(log^2 n).
Combines all node values on the path from u to v using the binary operation Op.
| [in] | u | Source node ID. |
| [in] | v | Target node ID. |
Definition at line 902 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::chain_head(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::depth(), Aleph::Gen_HLD< GT, T, Op, SA >::ensure_not_empty(), Aleph::Gen_HLD< GT, T, Op, SA >::identity_, Aleph::Gen_HLD< GT, T, Op, SA >::op_, Aleph::hld_detail::HLD_Tree_Data< GT, SA >::parent(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::pos(), Aleph::Gen_HLD< GT, T, Op, SA >::seg_, Aleph::Gen_HLD< GT, T, Op, SA >::topology_, and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::validate_id().
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::path_query(), and TYPED_TEST().
|
inline |
Point update by node pointer: set value to new_value.
Definition at line 1023 of file HLD.H.
References Aleph::Gen_HLD< GT, T, Op, SA >::id_of(), and Aleph::Gen_HLD< GT, T, Op, SA >::point_update_id().
Referenced by TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().
|
inline |
Point update by node ID: set value to new_value.
| [in] | v | Node ID. |
| [in] | new_value | New value for the node. |
Definition at line 1014 of file HLD.H.
References Aleph::Gen_HLD< GT, T, Op, SA >::ensure_not_empty(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::pos(), Aleph::Gen_HLD< GT, T, Op, SA >::seg_, Aleph::Gen_HLD< GT, T, Op, SA >::topology_, and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::validate_id().
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::point_update(), TYPED_TEST(), and TYPED_TEST().
|
inline |
HLD flat-array position of node id.
Definition at line 830 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::pos(), Aleph::Gen_HLD< GT, T, Op, SA >::topology_, and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::validate_id().
Referenced by TYPED_TEST().
|
inlinenoexcept |
Read-only access to the flat-position array.
position_array()(id) gives the segment-tree index of node id.
Definition at line 1083 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::pos(), and Aleph::Gen_HLD< GT, T, Op, SA >::topology_.
|
inlinenoexcept |
Returns the root node.
Definition at line 812 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::root(), and Aleph::Gen_HLD< GT, T, Op, SA >::topology_.
Referenced by TYPED_TEST().
|
inlinenoexcept |
Returns the internal ID of the root node.
Definition at line 815 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::root_id(), and Aleph::Gen_HLD< GT, T, Op, SA >::topology_.
Referenced by TYPED_TEST().
|
inlinenoexcept |
Total number of nodes in the tree.
Definition at line 806 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::size(), and Aleph::Gen_HLD< GT, T, Op, SA >::topology_.
Referenced by TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().
|
inline |
Subtree query by node pointer in O(log n).
Definition at line 1000 of file HLD.H.
References Aleph::Gen_HLD< GT, T, Op, SA >::id_of(), and Aleph::Gen_HLD< GT, T, Op, SA >::subtree_query_id().
Referenced by TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().
|
inline |
Subtree query by node ID in O(log n).
Combines all values in the subtree rooted at v.
Definition at line 989 of file HLD.H.
References Aleph::Gen_HLD< GT, T, Op, SA >::ensure_not_empty(), l, Aleph::hld_detail::HLD_Tree_Data< GT, SA >::pos(), r, Aleph::Gen_HLD< GT, T, Op, SA >::seg_, Aleph::hld_detail::HLD_Tree_Data< GT, SA >::subtree_size(), Aleph::Gen_HLD< GT, T, Op, SA >::topology_, and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::validate_id().
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::subtree_query(), and TYPED_TEST().
|
inlinenoexcept |
Read-only access to the subtree-size array.
Definition at line 1105 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::subtree_size(), and Aleph::Gen_HLD< GT, T, Op, SA >::topology_.
|
inline |
Subtree size of node.
Definition at line 864 of file HLD.H.
References Aleph::Gen_HLD< GT, T, Op, SA >::id_of(), and Aleph::Gen_HLD< GT, T, Op, SA >::subtree_size_of_id().
|
inline |
Subtree size of node id.
Definition at line 857 of file HLD.H.
References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::subtree_size(), Aleph::Gen_HLD< GT, T, Op, SA >::topology_, and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::validate_id().
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::subtree_size_of(), and TYPED_TEST().
Exchange in O(1) this HLD and another.
| [in,out] | other | HLD to exchange with. |
| what | swapping the operations, the values or the filters throws. They are exchanged before the topologies and the segment trees, which are exchanged together: if a swap throws, those before it are exchanged back, and both HLDs are left as they were, if the swap that threw left its arguments as they were. If a swap that puts one back throws too, both HLDs can only be destroyed or assigned. |
Definition at line 747 of file HLD.H.
References Aleph::and, Aleph::Gen_HLD< GT, T, Op, SA >::identity_, Aleph::Gen_HLD< GT, T, Op, SA >::op_, Aleph::Gen_HLD< GT, T, Op, SA >::seg_, Aleph::Gen_HLD< GT, T, Op, SA >::swap(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::swap(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::swap_but_filter(), Aleph::Gen_HLD< GT, T, Op, SA >::swap_but_topology_storage(), and Aleph::Gen_HLD< GT, T, Op, SA >::topology_.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::operator=(), Aleph::Gen_HLD< GT, T, Op, SA >::swap(), and Aleph::Gen_HLD< GT, T, Op, SA >::swap_but_topology_storage().
|
inlineprivate |
Definition at line 778 of file HLD.H.
References Aleph::Gen_HLD< GT, T, Op, SA >::identity_, Aleph::Gen_HLD< GT, T, Op, SA >::op_, Aleph::Gen_HLD< GT, T, Op, SA >::seg_, Aleph::Gen_HLD< GT, T, Op, SA >::swap(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::swap_filter(), and Aleph::Gen_HLD< GT, T, Op, SA >::topology_.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::swap().
|
private |
Definition at line 633 of file HLD.H.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::build_segment_tree(), 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 >::swap(), and Aleph::Gen_HLD< GT, T, Op, SA >::swap_but_topology_storage().
|
staticconstexprprivate |
Definition at line 630 of file HLD.H.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::parent_of().
|
private |
Definition at line 634 of file HLD.H.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::build_segment_tree(), 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 >::swap(), and Aleph::Gen_HLD< GT, T, Op, SA >::swap_but_topology_storage().
|
private |
Definition at line 635 of file HLD.H.
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 >::subtree_query_id(), Aleph::Gen_HLD< GT, T, Op, SA >::swap(), and Aleph::Gen_HLD< GT, T, Op, SA >::swap_but_topology_storage().
|
private |
Definition at line 632 of file HLD.H.
Referenced by Aleph::Gen_HLD< GT, T, Op, SA >::build_segment_tree(), 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 >::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 >::get_value_at_id(), Aleph::Gen_HLD< GT, T, Op, SA >::id_of(), Aleph::Gen_HLD< GT, T, Op, SA >::is_empty(), Aleph::Gen_HLD< GT, T, Op, SA >::lca_id(), Aleph::Gen_HLD< GT, T, Op, SA >::n(), Aleph::Gen_HLD< GT, T, Op, SA >::node_of(), Aleph::Gen_HLD< GT, T, Op, SA >::num_chains(), 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(), 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(), Aleph::Gen_HLD< GT, T, Op, SA >::root(), Aleph::Gen_HLD< GT, T, Op, SA >::root_id(), Aleph::Gen_HLD< GT, T, Op, SA >::size(), Aleph::Gen_HLD< GT, T, Op, SA >::subtree_query_id(), Aleph::Gen_HLD< GT, T, Op, SA >::subtree_size_array(), Aleph::Gen_HLD< GT, T, Op, SA >::subtree_size_of_id(), Aleph::Gen_HLD< GT, T, Op, SA >::swap(), and Aleph::Gen_HLD< GT, T, Op, SA >::swap_but_topology_storage().