TTK
|
Class to answer the lowest common ancestor requests of pairs of nodes in a tree in constant time after a linear time preprocess. More...
#include <LowestCommonAncestor.h>
Classes | |
class | Node |
Public Member Functions | |
LowestCommonAncestor () | |
int | addNode () |
void | addNodes (const unsigned int &number) |
unsigned int | getNumberOfNodes () const |
Get the number of nodes in the tree. | |
Node & | getNode (const unsigned int &id) |
int | preprocess () |
int | query (int i, int j) const |
Public Member Functions inherited from ttk::Debug | |
Debug () | |
~Debug () override | |
virtual int | setDebugLevel (const int &debugLevel) |
int | setWrapper (const Wrapper *wrapper) override |
int | printMsg (const std::string &msg, const debug::Priority &priority=debug::Priority::INFO, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const |
int | printMsg (const std::vector< std::string > &msgs, const debug::Priority &priority=debug::Priority::INFO, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const |
int | printErr (const std::string &msg, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cerr) const |
int | printWrn (const std::string &msg, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cerr) const |
int | printMsg (const std::string &msg, const double &progress, const double &time, const int &threads, const double &memory, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const |
int | printMsg (const std::string &msg, const double &progress, const double &time, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const |
int | printMsg (const std::string &msg, const double &progress, const double &time, const int &threads, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const |
int | printMsg (const std::string &msg, const double &progress, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const |
int | printMsg (const std::string &msg, const double &progress, const debug::Priority &priority, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const |
int | printMsg (const std::vector< std::vector< std::string > > &rows, const debug::Priority &priority=debug::Priority::INFO, const bool hasHeader=true, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const |
int | printMsg (const debug::Separator &separator, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::INFO, std::ostream &stream=std::cout) const |
int | printMsg (const debug::Separator &separator, const debug::Priority &priority, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const |
int | printMsg (const std::string &msg, const debug::Separator &separator, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::INFO, std::ostream &stream=std::cout) const |
void | setDebugMsgPrefix (const std::string &prefix) |
Public Member Functions inherited from ttk::BaseClass | |
BaseClass () | |
virtual | ~BaseClass ()=default |
int | getThreadNumber () const |
virtual int | setThreadNumber (const int threadNumber) |
Protected Member Functions | |
int | computeBlocs () |
int | eulerianTransverse () |
int | RMQuery (const int &i, const int &j) const |
unsigned int | min_pos_3 (const std::array< int, 3 > &triplet) const |
Protected Member Functions inherited from ttk::Debug | |
int | printMsgInternal (const std::string &msg, const std::string &right, const std::string &filler, const debug::Priority &priority=debug::Priority::INFO, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const |
int | printMsgInternal (const std::string &msg, const debug::Priority &priority, const debug::LineMode &lineMode, std::ostream &stream=std::cout) const |
int | welcomeMsg (std::ostream &stream) |
Protected Attributes | |
std::vector< Node > | node_ {} |
std::vector< int > | nodeOrder_ {} |
std::vector< int > | nodeDepth_ {} |
std::vector< int > | nodeFirstAppearance_ {} |
int | blocSize_ {} |
std::vector< std::pair< int, int > > | blocPartition_ {} |
std::vector< int > | blocMinimumValue_ {} |
RangeMinimumQuery< int > | blocMinimumValueRMQ_ {} |
std::vector< int > | blocMinimumPosition_ {} |
std::vector< std::vector< std::vector< int > > > | normalizedBlocTable_ {} |
std::vector< int > | blocToNormalizedBloc_ {} |
Protected Attributes inherited from ttk::Debug | |
int | debugLevel_ |
std::string | debugMsgPrefix_ |
std::string | debugMsgNamePrefix_ |
Protected Attributes inherited from ttk::BaseClass | |
bool | lastObject_ |
int | threadNumber_ |
Wrapper * | wrapper_ |
Additional Inherited Members | |
Static Protected Attributes inherited from ttk::Debug | |
static COMMON_EXPORTS debug::LineMode | lastLineMode = ttk::debug::LineMode::NEW |
Class to answer the lowest common ancestor requests of pairs of nodes in a tree in constant time after a linear time preprocess.
Definition at line 20 of file LowestCommonAncestor.h.
ttk::LowestCommonAncestor::LowestCommonAncestor | ( | ) |
Definition at line 10 of file LowestCommonAncestor.cpp.
|
inline |
Add a node in the tree
Definition at line 53 of file LowestCommonAncestor.h.
|
inline |
Definition at line 60 of file LowestCommonAncestor.h.
|
protected |
Definition at line 80 of file LowestCommonAncestor.cpp.
|
protected |
Definition at line 175 of file LowestCommonAncestor.cpp.
|
inline |
Definition at line 73 of file LowestCommonAncestor.h.
|
inline |
Get the number of nodes in the tree.
Definition at line 68 of file LowestCommonAncestor.h.
|
inlineprotected |
Definition at line 96 of file LowestCommonAncestor.h.
int ttk::LowestCommonAncestor::preprocess | ( | ) |
Preprocess the tree structure to answer the query() calls in constant time. The preprocess takes linear time in number of nodes in the tree.
Definition at line 14 of file LowestCommonAncestor.cpp.
|
inline |
Get the id of the lowest common ancestor of i and j.
Definition at line 84 of file LowestCommonAncestor.h.
|
protected |
Definition at line 44 of file LowestCommonAncestor.cpp.
|
protected |
Definition at line 130 of file LowestCommonAncestor.h.
|
protected |
Definition at line 126 of file LowestCommonAncestor.h.
|
protected |
Definition at line 128 of file LowestCommonAncestor.h.
|
protected |
Definition at line 124 of file LowestCommonAncestor.h.
|
protected |
Definition at line 122 of file LowestCommonAncestor.h.
|
protected |
Definition at line 134 of file LowestCommonAncestor.h.
|
protected |
Definition at line 114 of file LowestCommonAncestor.h.
|
protected |
Definition at line 118 of file LowestCommonAncestor.h.
|
protected |
Definition at line 119 of file LowestCommonAncestor.h.
|
protected |
Definition at line 117 of file LowestCommonAncestor.h.
|
protected |
Definition at line 132 of file LowestCommonAncestor.h.