Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::hld_detail::HLD_Tree_Data< GT, SA > Class Template Reference

#include <HLD.H>

Inheritance diagram for Aleph::hld_detail::HLD_Tree_Data< GT, SA >:
[legend]
Collaboration diagram for Aleph::hld_detail::HLD_Tree_Data< GT, SA >:
[legend]

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())
 
 HLD_Tree_Data (const HLD_Tree_Data &other)=default
 Copy the decomposition of another tree.
 
 HLD_Tree_Data (HLD_Tree_Data &&other) noexcept(std::is_nothrow_move_constructible_v< SA >)
 Take the decomposition of another tree, which is left empty.
 
HLD_Tree_Data & operator= (const HLD_Tree_Data &other)=default
 Copy the decomposition of another tree.
 
HLD_Tree_Data & operator= (HLD_Tree_Data &&other) noexcept(noexcept(swap(other)))
 Exchange this topology with another, which is left with the previous decomposition of this one.
 
void swap (HLD_Tree_Data &other) noexcept(std::is_nothrow_swappable_v< SA >)
 Exchange in O(1) this topology and another.
 
void swap_filter (HLD_Tree_Data &other) noexcept(std::is_nothrow_swappable_v< SA >)
 Exchange the filters of this topology and another, for an owner that exchanges something else before the rest.
 
void swap_but_filter (HLD_Tree_Data &other) noexcept
 Exchange in O(1) all but the filters of 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 > & 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
 

Detailed Description

template<AlephGraph GT, ArcFilter< GT > SA>
class Aleph::hld_detail::HLD_Tree_Data< GT, SA >

Definition at line 122 of file HLD.H.

Member Typedef Documentation

◆ Arc

template<AlephGraph GT, ArcFilter< GT > SA>
using Aleph::hld_detail::HLD_Tree_Data< GT, SA >::Arc = typename GT::Arc

Definition at line 127 of file HLD.H.

◆ Node

template<AlephGraph GT, ArcFilter< GT > SA>
using Aleph::hld_detail::HLD_Tree_Data< GT, SA >::Node = typename GT::Node

Definition at line 126 of file HLD.H.

◆ Pair_Key

template<AlephGraph GT, ArcFilter< GT > SA>
using Aleph::hld_detail::HLD_Tree_Data< GT, SA >::Pair_Key = std::pair<size_t, size_t>
private

Definition at line 132 of file HLD.H.

Constructor & Destructor Documentation

◆ HLD_Tree_Data() [1/3]

◆ HLD_Tree_Data() [2/3]

template<AlephGraph GT, ArcFilter< GT > SA>
Aleph::hld_detail::HLD_Tree_Data< GT, SA >::HLD_Tree_Data ( const HLD_Tree_Data< GT, SA > &  other)
default

Copy the decomposition of another tree.

Parameters
[in]othertopology to copy.

◆ HLD_Tree_Data() [3/3]

template<AlephGraph GT, ArcFilter< GT > SA>
Aleph::hld_detail::HLD_Tree_Data< GT, SA >::HLD_Tree_Data ( HLD_Tree_Data< GT, SA > &&  other)
inlinenoexcept

Take the decomposition 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 number of chains: the moved-from topology then passed the checks of the ids and read arrays that it no longer had.

Parameters
[in,out]othertopology to move from.

Definition at line 479 of file HLD.H.

Member Function Documentation

◆ build_simple_adjacency()

◆ chain_head()

◆ check_id()

template<AlephGraph GT, ArcFilter< GT > SA>
void Aleph::hld_detail::HLD_Tree_Data< GT, SA >::check_id ( const size_t  id,
const char *  where 
) const
inlineprivate

◆ compute_hld_positions()

◆ compute_sizes_and_parents()

◆ depth()

◆ id_of()

template<AlephGraph GT, ArcFilter< GT > SA>
size_t Aleph::hld_detail::HLD_Tree_Data< GT, SA >::id_of ( const Node *  node) const
inline

◆ id_to_node()

template<AlephGraph GT, ArcFilter< GT > SA>
const Array< Node * > & Aleph::hld_detail::HLD_Tree_Data< GT, SA >::id_to_node ( ) const
inlinenoexcept

◆ index_nodes()

◆ is_empty()

template<AlephGraph GT, ArcFilter< GT > SA>
bool Aleph::hld_detail::HLD_Tree_Data< GT, SA >::is_empty ( ) const
inlinenoexcept

◆ node_of()

template<AlephGraph GT, ArcFilter< GT > SA>
Node * Aleph::hld_detail::HLD_Tree_Data< GT, SA >::node_of ( const size_t  id) const
inline

◆ normalize_pair()

template<AlephGraph GT, ArcFilter< GT > SA>
static Pair_Key Aleph::hld_detail::HLD_Tree_Data< GT, SA >::normalize_pair ( size_t  u,
size_t  v 
)
inlinestaticprivatenoexcept

◆ num_chains()

template<AlephGraph GT, ArcFilter< GT > SA>
size_t Aleph::hld_detail::HLD_Tree_Data< GT, SA >::num_chains ( ) const
inlinenoexcept

◆ operator=() [1/2]

template<AlephGraph GT, ArcFilter< GT > SA>
HLD_Tree_Data & Aleph::hld_detail::HLD_Tree_Data< GT, SA >::operator= ( const HLD_Tree_Data< GT, SA > &  other)
default

Copy the decomposition of another tree.

Parameters
[in]othertopology to copy.
Returns
this topology.

◆ operator=() [2/2]

template<AlephGraph GT, ArcFilter< GT > SA>
HLD_Tree_Data & Aleph::hld_detail::HLD_Tree_Data< GT, SA >::operator= ( HLD_Tree_Data< GT, SA > &&  other)
inlinenoexcept

Exchange this topology with another, which is left with the previous decomposition of this one.

Parameters
[in,out]othertopology to move from.
Returns
this topology.

Definition at line 502 of file HLD.H.

References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::swap().

◆ parent()

◆ pos()

◆ reorder_adjacency_heavy_first()

◆ root()

template<AlephGraph GT, ArcFilter< GT > SA>
Node * Aleph::hld_detail::HLD_Tree_Data< GT, SA >::root ( ) const
inlinenoexcept

◆ root_id()

template<AlephGraph GT, ArcFilter< GT > SA>
size_t Aleph::hld_detail::HLD_Tree_Data< GT, SA >::root_id ( ) const
inlinenoexcept

◆ size()

template<AlephGraph GT, ArcFilter< GT > SA>
size_t Aleph::hld_detail::HLD_Tree_Data< GT, SA >::size ( ) const
inlinenoexcept

◆ subtree_size()

template<AlephGraph GT, ArcFilter< GT > SA>
const Array< size_t > & Aleph::hld_detail::HLD_Tree_Data< GT, SA >::subtree_size ( ) const
inlinenoexcept

◆ swap()

template<AlephGraph GT, ArcFilter< GT > SA>
void Aleph::hld_detail::HLD_Tree_Data< GT, SA >::swap ( HLD_Tree_Data< GT, SA > &  other)
inlinenoexcept

Exchange in O(1) this topology and another.

Parameters
[in,out]othertopology to exchange with.
Exceptions
whatswapping the filters throws. They are exchanged first, so that, if that swap throws, nothing else is exchanged, and both topologies are left as they were if it left its arguments as they were.

Definition at line 515 of file HLD.H.

References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::swap_but_filter(), and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::swap_filter().

Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::operator=(), Aleph::Gen_HLD< GT, T, Op, SA >::swap(), and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::swap_filter().

◆ swap_but_filter()

◆ swap_filter()

template<AlephGraph GT, ArcFilter< GT > SA>
void Aleph::hld_detail::HLD_Tree_Data< GT, SA >::swap_filter ( HLD_Tree_Data< GT, SA > &  other)
inlinenoexcept

Exchange the filters of this topology and another, for an owner that exchanges something else before the rest.

Parameters
[in,out]othertopology to exchange with.
Exceptions
whatswapping the filters throws.

Definition at line 526 of file HLD.H.

References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::sa_, and Aleph::hld_detail::HLD_Tree_Data< GT, SA >::swap().

Referenced by Aleph::hld_detail::HLD_Tree_Data< GT, SA >::swap(), and Aleph::Gen_HLD< GT, T, Op, SA >::swap_but_topology_storage().

◆ tin()

template<AlephGraph GT, ArcFilter< GT > SA>
const Array< size_t > & Aleph::hld_detail::HLD_Tree_Data< GT, SA >::tin ( ) const
inlinenoexcept

Definition at line 568 of file HLD.H.

References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::tin_.

◆ tout()

template<AlephGraph GT, ArcFilter< GT > SA>
const Array< size_t > & Aleph::hld_detail::HLD_Tree_Data< GT, SA >::tout ( ) const
inlinenoexcept

Definition at line 569 of file HLD.H.

References Aleph::hld_detail::HLD_Tree_Data< GT, SA >::tout_.

◆ validate_id()

Member Data Documentation

◆ adjacency_

◆ chain_head_

◆ depth_

◆ graph_

◆ id_to_node_

◆ n_

◆ node_to_id_

◆ NONE

template<AlephGraph GT, ArcFilter< GT > SA>
constexpr size_t Aleph::hld_detail::HLD_Tree_Data< GT, SA >::NONE = std::numeric_limits<size_t>::max()
staticconstexpr

◆ num_chains_

◆ parent_

◆ pos_

◆ root_

◆ root_id_

◆ sa_

template<AlephGraph GT, ArcFilter< GT > SA>
SA Aleph::hld_detail::HLD_Tree_Data< GT, SA >::sa_
private

◆ subtree_size_

◆ tin_

◆ tout_


The documentation for this class was generated from the following file: