LAL: Linear Arrangement Library 24.10.00
A library focused on algorithms on linear arrangements of graphs.
Loading...
Searching...
No Matches
lal::detail::chunks_Anderson< arrangement_t > Class Template Reference

Implementation of Anderson's algorithm for chunking. More...

#include <Anderson.hpp>

Inheritance diagram for lal::detail::chunks_Anderson< arrangement_t >:
lal::detail::chunks_generic< arrangement_t >

Public Member Functions

 chunks_Anderson (const graphs::rooted_tree &rt, const arrangement_t &arr) noexcept
 Constructor.
 
void chunk_input_tree () noexcept
 Main method of this class.
 
const linarr::chunk_sequenceget_chunk_sequence () const noexcept
 Returns a constant reference to the chunk sequence m_sequence.
 
linarr::chunk_sequence && retrieve_chunk_sequence () noexcept
 Moves the chunk sequence m_sequence.
 

Private Types

typedef chunks_generic< arrangement_t > generic
 Useful typedef.
 

Private Member Functions

bool can_be_added (const node r, const node u) const noexcept
 Can node u be added to the same chunk as r.
 
void assign_chunk_indices (const node_t r, std::size_t &chunk_idx) noexcept
 Assign chunk indices to all vertices of the subtree rooted at r.
 
void relabel_chunks () noexcept
 Relabels the chunks obtained in method assign_chunk_indices.
 
void make_chunks () noexcept
 Actually builds the sequence of chunks.
 
void set_parent_chunk (linarr::chunk &c) noexcept
 Set the parent node of a chunks.
 
void set_chunk_index (const node u, const std::size_t i) noexcept
 Sets the chunk index of node u to index i.
 
std::size_t node_to_chunk (const node u) const noexcept
 Returns the chunk index of node u.
 
linarr::chunklast_chunk () noexcept
 Returns a reference to the last chunk in the sentence.
 

Private Attributes

linarr::chunk_sequence m_sequence
 The sequence of chunks obtained.
 
const uint64_t m_n
 Number of vertices of the tree.
 
const arrangement_t m_arr
 Linear arrangement.
 
const graphs::rooted_treem_rt
 Input rooted tree.
 

Detailed Description

template<class arrangement_t>
class lal::detail::chunks_Anderson< arrangement_t >

Implementation of Anderson's algorithm for chunking.

Chunking applied to syntactic dependency trees alone (a.k.a., rooted trees).

See [12] and [11] for a complete definition of Anderson (et al.)'s chunks.

Template Parameters
arr_tType of arrangement.

Constructor & Destructor Documentation

◆ chunks_Anderson()

template<class arrangement_t >
lal::detail::chunks_Anderson< arrangement_t >::chunks_Anderson ( const graphs::rooted_tree & rt,
const arrangement_t & arr )
inlinenoexcept

Constructor.

Parameters
rtInput rooted tree.
arrInput linear arrangement.

Member Function Documentation

◆ assign_chunk_indices()

template<class arrangement_t >
void lal::detail::chunks_Anderson< arrangement_t >::assign_chunk_indices ( const node_t r,
std::size_t & chunk_idx )
inlineprivatenoexcept

Assign chunk indices to all vertices of the subtree rooted at r.

Parameters
rRoot of the current subtree.
[in,out]chunk_idxCurrent chunk index.

◆ chunk_input_tree()

template<class arrangement_t >
void lal::detail::chunks_Anderson< arrangement_t >::chunk_input_tree ( )
inlinenoexcept

Main method of this class.

Calling this method will chunk the input rooted tree using Anderson (et al.)'s definition.

◆ make_chunks()

template<class arrangement_t >
void lal::detail::chunks_Anderson< arrangement_t >::make_chunks ( )
inlineprivatenoexcept

Actually builds the sequence of chunks.

Puts all equally-labelled nodes in the same chunk and computes the parent node for each chunk.

◆ relabel_chunks()

template<class arrangement_t >
void lal::detail::chunks_Anderson< arrangement_t >::relabel_chunks ( )
inlineprivatenoexcept

Relabels the chunks obtained in method assign_chunk_indices.

Reassigns labels to chunks so that the leftmost chunk is labelled 0.


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