timemory 3.3.0
Modular C++ Toolkit for Performance Analysis and Logging. Profiling API and Tools for C, C++, CUDA, Fortran, and Python. The C++ template API is essentially a framework to creating tools: it is designed to provide a unifying interface for recording various performance measurements alongside data logging and interfaces to other tools.
|
Arbitrary Graph / Tree (i.e. binary-tree but not binary). It is unlikely that this class will interacted with directly. More...
#include "timemory/storage/graph.hpp"
Classes | |
class | iterator_base |
Base class for iterators, only pointers stored, no traversal logic. More... | |
class | pre_order_iterator |
Depth-first iterator, first accessing the node, then its children. More... | |
class | sibling_iterator |
Iterator which traverses only the nodes which are siblings of each other. More... | |
Public Types | |
using | value_type = T |
Value of the data stored at a node. More... | |
typedef pre_order_iterator | iterator |
The default iterator types throughout the graph class. More... | |
typedef const iterator | const_iterator |
typedef iterator::difference_type | difference_type |
Public Member Functions | |
graph () | |
graph (const T &) | |
graph (const iterator_base &) | |
~graph () | |
graph (const this_type &)=delete | |
graph (this_type &&) noexcept=default | |
graph & | operator= (const graph &)=delete |
graph & | operator= (graph &&) noexcept=default |
pre_order_iterator | begin () const |
Return iterator to the beginning of the graph. More... | |
pre_order_iterator | end () const |
Return iterator to the end of the graph. More... | |
void | clear () |
Erase all nodes of the graph. More... | |
template<typename IterT > | |
IterT | erase (IterT) |
Erase element at position pointed to by iterator, return incremented iterator. More... | |
void | erase_children (const iterator_base &) |
Erase all children of the node pointed to by iterator. More... | |
template<typename IterT > | |
IterT | append_child (IterT position) |
Insert empty node as last/first child of node pointed to by position. More... | |
template<typename IterT > | |
IterT | prepend_child (IterT position) |
template<typename IterT > | |
IterT | append_child (IterT position, const T &x) |
Insert node as last/first child of node pointed to by position. More... | |
template<typename IterT > | |
IterT | append_child (IterT position, T &&x) |
template<typename IterT > | |
IterT | prepend_child (IterT position, const T &x) |
template<typename IterT > | |
IterT | prepend_child (IterT position, T &&x) |
template<typename IterT > | |
IterT | append_child (IterT position, IterT other_position) |
Append the node (plus its children) at other_position as last/first child of position. More... | |
template<typename IterT > | |
IterT | prepend_child (IterT position, IterT other_position) |
template<typename IterT > | |
IterT | append_children (IterT position, sibling_iterator from, const sibling_iterator &to) |
Append the nodes in the from-to range (plus their children) as last/first children of position. More... | |
template<typename IterT > | |
IterT | prepend_children (IterT position, sibling_iterator from, sibling_iterator to) |
pre_order_iterator | set_head (const T &x) |
Short-hand to insert topmost node in otherwise empty graph. More... | |
pre_order_iterator | set_head (T &&x) |
template<typename IterT > | |
IterT | insert (IterT position, const T &x) |
Insert node as previous sibling of node pointed to by position. More... | |
template<typename IterT > | |
IterT | insert (IterT position, T &&x) |
sibling_iterator | insert (sibling_iterator position, const T &x) |
Specialisation of previous member. More... | |
template<typename IterT > | |
IterT | insert_subgraph (IterT position, const iterator_base &subgraph) |
Insert node (with children) pointed to by subgraph as previous sibling of node pointed to by position. Does not change the subgraph itself (use move_in or move_in_below for that). More... | |
template<typename IterT > | |
IterT | insert_after (IterT position, const T &x) |
Insert node as next sibling of node pointed to by position. More... | |
template<typename IterT > | |
IterT | insert_after (IterT position, T &&x) |
template<typename IterT > | |
IterT | insert_subgraph_after (IterT position, const iterator_base &subgraph) |
Insert node (with children) pointed to by subgraph as next sibling of node pointed to by position. More... | |
template<typename IterT > | |
IterT | replace (IterT position, const T &x) |
Replace node at 'position' with other node (keeping same children); 'position' becomes invalid. More... | |
template<typename IterT > | |
IterT | replace (IterT position, T &&x) |
template<typename IterT > | |
IterT | replace (IterT position, const iterator_base &from) |
Replace node at 'position' with subgraph starting at 'from' (do not erase subgraph at 'from'); see above. More... | |
sibling_iterator | replace (sibling_iterator orig_begin, const sibling_iterator &orig_end, sibling_iterator new_begin, const sibling_iterator &new_end) |
Replace string of siblings (plus their children) with copy of a new string (with children); see above. More... | |
template<typename IterT > | |
IterT | flatten (IterT position) |
Move all children of node at 'position' to be siblings, returns position. More... | |
template<typename IterT > | |
IterT | reparent (IterT position, sibling_iterator begin, const sibling_iterator &end) |
Move nodes in range to be children of 'position'. More... | |
template<typename IterT > | |
IterT | reparent (IterT position, IterT from) |
Move all child nodes of 'from' to be children of 'position'. More... | |
template<typename IterT > | |
IterT | wrap (IterT position, const T &x) |
Replace node with a new node, making the old node (plus subgraph) a child of the new node. More... | |
template<typename IterT > | |
IterT | wrap (IterT from, IterT to, const T &x) |
Replace the range of sibling nodes (plus subgraphs), making these children of the new node. More... | |
template<typename IterT > | |
IterT | move_after (IterT target, IterT source) |
Move 'source' node (plus its children) to become the next sibling of 'target'. More... | |
template<typename IterT > | |
IterT | move_before (IterT target, IterT source) |
Move 'source' node (plus its children) to become the previous sibling of 'target'. More... | |
sibling_iterator | move_before (sibling_iterator target, sibling_iterator source) |
template<typename IterT > | |
IterT | move_ontop (IterT target, IterT source) |
Move 'source' node (plus its children) to become the node at 'target' (erasing the node at 'target'). More... | |
graph | move_out (iterator) |
Extract the subgraph starting at the indicated node, removing it from the original graph. More... | |
template<typename IterT > | |
IterT | move_in (IterT, graph &) |
Inverse of take_out: inserts the given graph as previous sibling of indicated node by a move operation, that is, the given graph becomes empty. Returns iterator to the top node. More... | |
template<typename IterT > | |
IterT | move_in_below (IterT, graph &) |
As above, but now make the graph a child of the indicated node. More... | |
template<typename IterT > | |
IterT | move_in_as_nth_child (IterT, size_t, graph &) |
As above, but now make the graph the nth child of the indicated node (if possible). More... | |
void | merge (const sibling_iterator &, const sibling_iterator &, sibling_iterator, const sibling_iterator &, bool duplicate_leaves=false, bool first=false) |
Merge with other graph, creating new branches and leaves only if they are not already present. More... | |
template<typename ComparePred = std::function<bool(sibling_iterator, sibling_iterator)>, typename ReducePred = std::function<void(sibling_iterator, sibling_iterator)>> | |
void | reduce (const sibling_iterator &, const sibling_iterator &, std::set< sibling_iterator > &, ComparePred &&=[](sibling_iterator lhs, sibling_iterator rhs) { return(*lhs== *rhs);}, ReducePred &&=[](sibling_iterator lhs, sibling_iterator rhs) { *lhs+= *rhs;}) |
Reduce duplicate nodes. More... | |
template<typename IterT > | |
bool | equal (const IterT &one, const IterT &two, const IterT &three) const |
Compare two ranges of nodes (compares nodes as well as graph structure). More... | |
template<typename IterT , typename BinaryPredicate > | |
bool | equal (const IterT &one, const IterT &two, const IterT &three, BinaryPredicate) const |
template<typename IterT > | |
bool | equal_subgraph (const IterT &one, const IterT &two) const |
template<typename IterT , typename BinaryPredicate > | |
bool | equal_subgraph (const IterT &one, const IterT &two, BinaryPredicate) const |
graph | subgraph (sibling_iterator from, sibling_iterator to) const |
Extract a new graph formed by the range of siblings plus all their children. More... | |
void | subgraph (graph &, sibling_iterator from, sibling_iterator to) const |
void | swap (sibling_iterator it) |
Exchange the node (plus subgraph) with its sibling node (do nothing if no sibling present). More... | |
void | swap (iterator, iterator) |
Exchange two nodes (plus subgraphs). The iterators will remain valid and keep pointing to the same nodes, which now sit at different locations in the graph. More... | |
size_t | size () const |
Count the total number of nodes. More... | |
bool | empty () const |
Check if graph is empty. More... | |
int | max_depth () const |
Determine the maximal depth of the graph. An empty graph has max_depth=-1. More... | |
int | max_depth (const iterator_base &) const |
Determine the maximal depth of the graph with top node at the given position. More... | |
unsigned int | number_of_siblings (const iterator_base &) const |
Count the number of siblings (left and right) of node at iterator. Total nodes at this level is +1. More... | |
bool | is_in_subgraph (const iterator_base &position, const iterator_base &begin, const iterator_base &end) const |
Determine whether node at position is in the subgraphs with root in the range. More... | |
bool | is_valid (const iterator_base &) const |
Determine whether the iterator is an 'end' iterator and thus not actually pointing to a node. More... | |
unsigned int | index (sibling_iterator it) const |
Determine the index of a node in the range of siblings to which it belongs. More... | |
sibling_iterator | sibling (const iterator_base &position, unsigned int) const |
Return iterator to the sibling indicated by index. More... | |
template<typename Archive > | |
void | serialize (Archive &ar, const unsigned int) |
void | steal_resources (this_type &rhs) |
Static Public Member Functions | |
static sibling_iterator | begin (const iterator_base &) |
Return sibling iterator to the first child of given node. More... | |
static sibling_iterator | end (const iterator_base &) |
Return sibling end iterator for children of given node. More... | |
template<typename IterT > | |
static IterT | parent (IterT) |
Return iterator to the parent of a node. More... | |
template<typename IterT > | |
static IterT | previous_sibling (IterT) |
Return iterator to the previous sibling of a node. More... | |
template<typename IterT > | |
static IterT | next_sibling (IterT) |
Return iterator to the next sibling of a node. More... | |
static int | depth (const iterator_base &) |
Compute the depth to the root or to a fixed other iterator. More... | |
static int | depth (const iterator_base &, const iterator_base &) |
static unsigned int | number_of_children (const iterator_base &) |
Count the number of children of node at position. More... | |
static bool | is_head (const iterator_base &) |
Determine whether the iterator is one of the 'head' nodes at the top level, i.e. has no parent. More... | |
static sibling_iterator | child (const iterator_base &position, unsigned int) |
Inverse of 'index': return the n-th child of the node at position. More... | |
Public Attributes | |
graph_node * | head = nullptr |
graph_node * | feet = nullptr |
Protected Types | |
using | graph_node = tgraph_node< T > |
using | this_type = graph< T, AllocatorT > |
Arbitrary Graph / Tree (i.e. binary-tree but not binary). It is unlikely that this class will interacted with directly.
typedef const iterator tim::graph< T, AllocatorT >::const_iterator |
typedef iterator::difference_type tim::graph< T, AllocatorT >::difference_type |
|
protected |
typedef pre_order_iterator tim::graph< T, AllocatorT >::iterator |
|
protected |
using tim::graph< T, AllocatorT >::value_type = T |
tim::graph< T, AllocatorT >::graph |
tim::graph< T, AllocatorT >::graph | ( | const T & | x | ) |
Definition at line 564 of file graph.hpp.
References tim::graph< T, AllocatorT >::set_head().
tim::graph< T, AllocatorT >::graph | ( | const iterator_base & | other | ) |
Definition at line 573 of file graph.hpp.
References tim::graph< T, AllocatorT >::iterator_base::begin(), tim::graph< T, AllocatorT >::replace(), and tim::graph< T, AllocatorT >::set_head().
tim::graph< T, AllocatorT >::~graph |
Definition at line 583 of file graph.hpp.
References tim::graph< T, AllocatorT >::clear(), tim::invoke::destroy(), tim::graph< T, AllocatorT >::feet, tim::graph< T, AllocatorT >::head, and tim::data::shared_stateful_allocator< AllocT >::release().
|
delete |
|
defaultnoexcept |
|
inline |
Insert empty node as last/first child of node pointed to by position.
Definition at line 789 of file graph.hpp.
References tim::graph< T, AllocatorT >::feet, and tim::graph< T, AllocatorT >::head.
Referenced by tim::graph_data< NodeT >::append_child(), tim::graph< T, AllocatorT >::append_child(), tim::graph_data< NodeT >::append_head(), tim::graph_data< NodeT >::emplace_child(), and tim::graph< T, AllocatorT >::merge().
|
inline |
Insert node as last/first child of node pointed to by position.
Definition at line 851 of file graph.hpp.
References tim::graph< T, AllocatorT >::feet, and tim::graph< T, AllocatorT >::head.
|
inline |
Append the node (plus its children) at other_position as last/first child of position.
Definition at line 981 of file graph.hpp.
References tim::graph< T, AllocatorT >::append_child(), tim::graph< T, AllocatorT >::feet, tim::graph< T, AllocatorT >::head, and tim::graph< T, AllocatorT >::move_ontop().
|
inline |
Definition at line 886 of file graph.hpp.
References tim::graph< T, AllocatorT >::feet, and tim::graph< T, AllocatorT >::head.
|
inline |
Append the nodes in the from-to range (plus their children) as last/first children of position.
Definition at line 1011 of file graph.hpp.
References tim::graph< T, AllocatorT >::feet, tim::graph< T, AllocatorT >::head, and tim::graph< T, AllocatorT >::insert_subgraph().
|
inline |
Return iterator to the beginning of the graph.
Definition at line 708 of file graph.hpp.
References tim::graph< T, AllocatorT >::pre_order_iterator::pre_order_iterator(), tim::graph< T, AllocatorT >::head, and tim::tgraph_node< T >::next_sibling.
Referenced by tim::graph_data< NodeT >::begin(), tim::print_graph(), tim::print_graph_bracketed(), tim::print_graph_hierarchy(), tim::print_subgraph(), tim::print_subgraph_bracketed(), tim::print_subgraph_hierarchy(), and tim::graph< T, AllocatorT >::size().
|
static |
Return sibling iterator to the first child of given node.
Definition at line 726 of file graph.hpp.
References tim::graph< T, AllocatorT >::iterator_base::end(), and tim::pos.
|
static |
Inverse of 'index': return the n-th child of the node at position.
Definition at line 2397 of file graph.hpp.
References tim::tgraph_node< T >::first_child, tim::tgraph_node< T >::next_sibling, and tim::graph< T, AllocatorT >::iterator_base::node.
|
inline |
Erase all nodes of the graph.
Definition at line 631 of file graph.hpp.
References tim::graph< T, AllocatorT >::pre_order_iterator::pre_order_iterator(), tim::graph< T, AllocatorT >::erase(), tim::graph< T, AllocatorT >::feet, tim::graph< T, AllocatorT >::head, and tim::tgraph_node< T >::next_sibling.
Referenced by tim::graph< T, AllocatorT >::~graph(), tim::graph_data< NodeT >::~graph_data(), and tim::graph_data< NodeT >::clear().
|
static |
Compute the depth to the root or to a fixed other iterator.
Definition at line 2085 of file graph.hpp.
References tim::graph< T, AllocatorT >::iterator_base::node, and tim::pos.
Referenced by tim::print_subgraph_hierarchy().
|
static |
Definition at line 2102 of file graph.hpp.
References tim::graph< T, AllocatorT >::iterator_base::node, and tim::pos.
|
inline |
Check if graph is empty.
Definition at line 2074 of file graph.hpp.
References tim::graph< T, AllocatorT >::iterator_base::begin(), and tim::graph< T, AllocatorT >::iterator_base::end().
Referenced by tim::print_subgraph(), tim::print_subgraph_bracketed(), and tim::print_subgraph_hierarchy().
|
inline |
Return iterator to the end of the graph.
Definition at line 717 of file graph.hpp.
References tim::graph< T, AllocatorT >::pre_order_iterator::pre_order_iterator(), and tim::graph< T, AllocatorT >::feet.
Referenced by tim::graph< T, AllocatorT >::iterator_base::begin(), tim::graph_data< NodeT >::end(), tim::print_graph(), tim::print_graph_bracketed(), tim::print_graph_hierarchy(), tim::print_subgraph(), tim::print_subgraph_bracketed(), tim::print_subgraph_hierarchy(), and tim::graph< T, AllocatorT >::size().
|
static |
Return sibling end iterator for children of given node.
Definition at line 740 of file graph.hpp.
References tim::graph< T, AllocatorT >::sibling_iterator::m_parent, and tim::pos.
|
inline |
Compare two ranges of nodes (compares nodes as well as graph structure).
Definition at line 2009 of file graph.hpp.
References tim::graph< T, AllocatorT >::equal().
Referenced by tim::graph< T, AllocatorT >::equal(), and tim::graph< T, AllocatorT >::equal_subgraph().
|
inline |
Definition at line 2032 of file graph.hpp.
References tim::graph< T, AllocatorT >::is_valid(), and tim::graph< T, AllocatorT >::iterator_base::number_of_children().
|
inline |
Definition at line 2021 of file graph.hpp.
References tim::graph< T, AllocatorT >::equal_subgraph().
Referenced by tim::graph< T, AllocatorT >::equal_subgraph().
|
inline |
Definition at line 2057 of file graph.hpp.
References tim::graph< T, AllocatorT >::iterator_base::begin(), tim::graph< T, AllocatorT >::iterator_base::end(), tim::graph< T, AllocatorT >::equal(), and tim::graph< T, AllocatorT >::iterator_base::number_of_children().
|
inline |
Erase element at position pointed to by iterator, return incremented iterator.
Definition at line 666 of file graph.hpp.
References tim::invoke::destroy(), tim::graph< T, AllocatorT >::erase_children(), tim::graph< T, AllocatorT >::feet, tim::graph< T, AllocatorT >::head, tim::tgraph_node< T >::next_sibling, tim::tgraph_node< T >::parent, and tim::tgraph_node< T >::prev_sibling.
Referenced by tim::graph< T, AllocatorT >::clear(), tim::graph< T, AllocatorT >::erase_children(), tim::graph< T, AllocatorT >::move_ontop(), tim::graph< T, AllocatorT >::reduce(), and tim::graph< T, AllocatorT >::replace().
|
inline |
Erase all children of the node pointed to by iterator.
Definition at line 644 of file graph.hpp.
References tim::graph< T, AllocatorT >::pre_order_iterator::pre_order_iterator(), tim::graph< T, AllocatorT >::erase(), tim::graph< T, AllocatorT >::feet, tim::tgraph_node< T >::first_child, tim::tgraph_node< T >::last_child, tim::tgraph_node< T >::next_sibling, and tim::graph< T, AllocatorT >::iterator_base::node.
Referenced by tim::graph< T, AllocatorT >::erase(), tim::graph< T, AllocatorT >::replace(), and tim::graph_data< NodeT >::reset().
|
inline |
Move all children of node at 'position' to be siblings, returns position.
Definition at line 1430 of file graph.hpp.
References tim::tgraph_node< T >::first_child, tim::tgraph_node< T >::next_sibling, and tim::tgraph_node< T >::parent.
|
inline |
Determine the index of a node in the range of siblings to which it belongs.
Definition at line 2339 of file graph.hpp.
References tim::tgraph_node< T >::next_sibling, tim::graph< T, AllocatorT >::iterator_base::node, tim::tgraph_node< T >::parent, and tim::tgraph_node< T >::prev_sibling.
Referenced by tim::graph< T, AllocatorT >::reduce().
|
inline |
Insert node as previous sibling of node pointed to by position.
Definition at line 1078 of file graph.hpp.
References tim::graph< T, AllocatorT >::feet, and tim::graph< T, AllocatorT >::head.
Referenced by tim::graph< T, AllocatorT >::insert_subgraph(), tim::graph< T, AllocatorT >::set_head(), and tim::graph< T, AllocatorT >::wrap().
|
inline |
|
inline |
|
inline |
Insert node as next sibling of node pointed to by position.
Definition at line 1180 of file graph.hpp.
Referenced by tim::graph_data< NodeT >::add_dummy(), and tim::graph< T, AllocatorT >::insert_subgraph_after().
|
inline |
|
inline |
Insert node (with children) pointed to by subgraph as previous sibling of node pointed to by position. Does not change the subgraph itself (use move_in or move_in_below for that).
Definition at line 1239 of file graph.hpp.
References tim::graph< T, AllocatorT >::insert(), and tim::graph< T, AllocatorT >::replace().
Referenced by tim::graph< T, AllocatorT >::append_children(), tim::graph< T, AllocatorT >::merge(), tim::graph< T, AllocatorT >::prepend_children(), and tim::graph< T, AllocatorT >::replace().
|
inline |
Insert node (with children) pointed to by subgraph as next sibling of node pointed to by position.
Definition at line 1252 of file graph.hpp.
References tim::graph< T, AllocatorT >::insert_after(), and tim::graph< T, AllocatorT >::replace().
Referenced by tim::graph< T, AllocatorT >::reduce().
|
static |
Determine whether the iterator is one of the 'head' nodes at the top level, i.e. has no parent.
Definition at line 2328 of file graph.hpp.
References tim::graph< T, AllocatorT >::iterator_base::node, and tim::tgraph_node< T >::parent.
Referenced by tim::graph_data< NodeT >::pop_graph().
|
inline |
Determine whether node at position is in the subgraphs with root in the range.
|
inline |
Determine whether the iterator is an 'end' iterator and thus not actually pointing to a node.
Definition at line 2313 of file graph.hpp.
References tim::graph< T, AllocatorT >::feet, tim::graph< T, AllocatorT >::head, and tim::graph< T, AllocatorT >::iterator_base::node.
Referenced by tim::graph< T, AllocatorT >::equal(), and tim::graph< T, AllocatorT >::reduce().
|
inline |
Determine the maximal depth of the graph. An empty graph has max_depth=-1.
Definition at line 2119 of file graph.hpp.
References tim::graph< T, AllocatorT >::feet, tim::graph< T, AllocatorT >::head, std::max(), tim::graph< T, AllocatorT >::max_depth(), and tim::tgraph_node< T >::next_sibling.
Referenced by tim::graph< T, AllocatorT >::max_depth().
|
inline |
Determine the maximal depth of the graph with top node at the given position.
Definition at line 2132 of file graph.hpp.
References tim::graph< T, AllocatorT >::feet, tim::tgraph_node< T >::first_child, tim::graph< T, AllocatorT >::head, std::max(), tim::tgraph_node< T >::next_sibling, tim::tgraph_node< T >::parent, and tim::pos.
|
inline |
Merge with other graph, creating new branches and leaves only if they are not already present.
Definition at line 1883 of file graph.hpp.
References tim::graph< T, AllocatorT >::append_child(), tim::graph< T, AllocatorT >::iterator_base::begin(), tim::graph< T, AllocatorT >::iterator_base::end(), tim::graph< T, AllocatorT >::insert_subgraph(), tim::graph< T, AllocatorT >::merge(), tim::graph< T, AllocatorT >::number_of_siblings(), and tim::graph< T, AllocatorT >::parent().
Referenced by tim::graph< T, AllocatorT >::merge().
|
inline |
Move 'source' node (plus its children) to become the next sibling of 'target'.
Definition at line 1567 of file graph.hpp.
References tim::tgraph_node< T >::next_sibling, tim::tgraph_node< T >::parent, and tim::tgraph_node< T >::prev_sibling.
|
inline |
Move 'source' node (plus its children) to become the previous sibling of 'target'.
Definition at line 1621 of file graph.hpp.
References tim::tgraph_node< T >::next_sibling, tim::tgraph_node< T >::parent, and tim::tgraph_node< T >::prev_sibling.
|
inline |
|
inline |
Inverse of take_out: inserts the given graph as previous sibling of indicated node by a move operation, that is, the given graph becomes empty. Returns iterator to the top node.
Definition at line 1770 of file graph.hpp.
References tim::graph< T, AllocatorT >::feet, tim::graph< T, AllocatorT >::head, tim::tgraph_node< T >::next_sibling, tim::graph< T, AllocatorT >::iterator_base::node, tim::tgraph_node< T >::parent, and tim::tgraph_node< T >::prev_sibling.
|
inline |
As above, but now make the graph the nth child of the indicated node (if possible).
Definition at line 1808 of file graph.hpp.
References tim::graph< T, AllocatorT >::feet, tim::tgraph_node< T >::first_child, tim::graph< T, AllocatorT >::head, tim::tgraph_node< T >::last_child, tim::tgraph_node< T >::next_sibling, tim::tgraph_node< T >::parent, and tim::tgraph_node< T >::prev_sibling.
|
inline |
As above, but now make the graph a child of the indicated node.
|
inline |
Move 'source' node (plus its children) to become the node at 'target' (erasing the node at 'target').
Definition at line 1675 of file graph.hpp.
References tim::graph< T, AllocatorT >::erase(), tim::tgraph_node< T >::first_child, tim::tgraph_node< T >::last_child, tim::tgraph_node< T >::next_sibling, tim::tgraph_node< T >::parent, and tim::tgraph_node< T >::prev_sibling.
Referenced by tim::graph< T, AllocatorT >::append_child(), and tim::graph< T, AllocatorT >::prepend_child().
|
inline |
Extract the subgraph starting at the indicated node, removing it from the original graph.
Definition at line 1742 of file graph.hpp.
References tim::graph< T, AllocatorT >::feet, tim::graph< T, AllocatorT >::head, tim::tgraph_node< T >::next_sibling, tim::graph< T, AllocatorT >::iterator_base::node, tim::tgraph_node< T >::parent, and tim::tgraph_node< T >::prev_sibling.
|
static |
|
static |
Count the number of children of node at position.
Definition at line 2172 of file graph.hpp.
References tim::tgraph_node< T >::first_child, tim::graph< T, AllocatorT >::iterator_base::node, and tim::pos.
Referenced by tim::print_subgraph(), tim::print_subgraph_bracketed(), and tim::print_subgraph_hierarchy().
|
inline |
Count the number of siblings (left and right) of node at iterator. Total nodes at this level is +1.
Definition at line 2188 of file graph.hpp.
References tim::graph< T, AllocatorT >::feet, tim::graph< T, AllocatorT >::head, tim::graph< T, AllocatorT >::iterator_base::node, and tim::pos.
Referenced by tim::graph< T, AllocatorT >::merge(), tim::print_graph(), tim::print_graph_bracketed(), tim::print_graph_hierarchy(), tim::print_subgraph(), tim::print_subgraph_bracketed(), tim::print_subgraph_hierarchy(), and tim::graph< T, AllocatorT >::reduce().
|
delete |
|
defaultnoexcept |
|
static |
Return iterator to the parent of a node.
Definition at line 752 of file graph.hpp.
Referenced by tim::graph< T, AllocatorT >::merge().
|
inline |
Definition at line 820 of file graph.hpp.
References tim::graph< T, AllocatorT >::feet, and tim::graph< T, AllocatorT >::head.
Referenced by tim::graph< T, AllocatorT >::prepend_child().
|
inline |
Definition at line 918 of file graph.hpp.
References tim::graph< T, AllocatorT >::feet, and tim::graph< T, AllocatorT >::head.
|
inline |
Definition at line 996 of file graph.hpp.
References tim::graph< T, AllocatorT >::feet, tim::graph< T, AllocatorT >::head, tim::graph< T, AllocatorT >::move_ontop(), and tim::graph< T, AllocatorT >::prepend_child().
|
inline |
Definition at line 949 of file graph.hpp.
References tim::graph< T, AllocatorT >::feet, and tim::graph< T, AllocatorT >::head.
|
inline |
Definition at line 1033 of file graph.hpp.
References tim::graph< T, AllocatorT >::feet, tim::graph< T, AllocatorT >::head, and tim::graph< T, AllocatorT >::insert_subgraph().
|
static |
|
inline |
Reduce duplicate nodes.
Definition at line 1940 of file graph.hpp.
References tim::graph< T, AllocatorT >::erase(), tim::graph< T, AllocatorT >::feet, tim::graph< T, AllocatorT >::index(), tim::graph< T, AllocatorT >::insert_subgraph_after(), tim::graph< T, AllocatorT >::is_valid(), tim::graph< T, AllocatorT >::iterator_base::node, tim::graph< T, AllocatorT >::number_of_siblings(), tim::graph< T, AllocatorT >::reduce(), and tim::graph< T, AllocatorT >::sibling().
Referenced by tim::graph< T, AllocatorT >::reduce().
|
inline |
Move all child nodes of 'from' to be children of 'position'.
Definition at line 1526 of file graph.hpp.
References tim::graph< T, AllocatorT >::iterator_base::end(), and tim::graph< T, AllocatorT >::reparent().
|
inline |
Move nodes in range to be children of 'position'.
Definition at line 1463 of file graph.hpp.
References tim::tgraph_node< T >::last_child, tim::tgraph_node< T >::next_sibling, tim::graph< T, AllocatorT >::iterator_base::node, tim::tgraph_node< T >::parent, tim::pos, and tim::tgraph_node< T >::prev_sibling.
Referenced by tim::graph< T, AllocatorT >::reparent(), and tim::graph< T, AllocatorT >::wrap().
|
inline |
Replace node at 'position' with subgraph starting at 'from' (do not erase subgraph at 'from'); see above.
Definition at line 1303 of file graph.hpp.
References tim::graph< T, AllocatorT >::erase_children(), tim::graph< T, AllocatorT >::head, and tim::graph< T, AllocatorT >::iterator_base::node.
|
inline |
Replace node at 'position' with other node (keeping same children); 'position' becomes invalid.
Definition at line 1279 of file graph.hpp.
References tim::invoke::destroy().
Referenced by tim::graph< T, AllocatorT >::graph(), tim::graph< T, AllocatorT >::insert_subgraph(), and tim::graph< T, AllocatorT >::insert_subgraph_after().
|
inline |
|
inline |
Replace string of siblings (plus their children) with copy of a new string (with children); see above.
Definition at line 1379 of file graph.hpp.
References tim::graph< T, AllocatorT >::pre_order_iterator::pre_order_iterator(), tim::graph< T, AllocatorT >::erase(), tim::graph< T, AllocatorT >::insert_subgraph(), tim::tgraph_node< T >::next_sibling, and tim::graph< T, AllocatorT >::iterator_base::node.
|
inline |
Definition at line 530 of file graph.hpp.
References tim::graph< T, AllocatorT >::iterator_base::begin(), and tim::graph< T, AllocatorT >::iterator_base::end().
|
inline |
Short-hand to insert topmost node in otherwise empty graph.
Definition at line 1057 of file graph.hpp.
References tim::graph< T, AllocatorT >::feet, tim::graph< T, AllocatorT >::head, tim::graph< T, AllocatorT >::insert(), and tim::tgraph_node< T >::next_sibling.
Referenced by tim::graph< T, AllocatorT >::graph(), and tim::graph_data< NodeT >::graph_data().
|
inline |
Definition at line 1067 of file graph.hpp.
References tim::graph< T, AllocatorT >::feet, tim::graph< T, AllocatorT >::head, tim::graph< T, AllocatorT >::insert(), and tim::tgraph_node< T >::next_sibling.
|
inline |
Return iterator to the sibling indicated by index.
Definition at line 2369 of file graph.hpp.
References tim::tgraph_node< T >::next_sibling, tim::graph< T, AllocatorT >::iterator_base::node, tim::tgraph_node< T >::parent, and tim::tgraph_node< T >::prev_sibling.
Referenced by tim::graph< T, AllocatorT >::reduce().
|
inline |
Count the total number of nodes.
Definition at line 2868 of file graph.hpp.
References tim::graph< T, AllocatorT >::begin(), and tim::graph< T, AllocatorT >::end().
|
inline |
|
inline |
|
inline |
Extract a new graph formed by the range of siblings plus all their children.
|
inline |
Exchange two nodes (plus subgraphs). The iterators will remain valid and keep pointing to the same nodes, which now sit at different locations in the graph.
Definition at line 2246 of file graph.hpp.
References tim::tgraph_node< T >::first_child, tim::tgraph_node< T >::last_child, tim::tgraph_node< T >::next_sibling, tim::graph< T, AllocatorT >::iterator_base::node, tim::tgraph_node< T >::parent, tim::tgraph_node< T >::prev_sibling, and tim::graph< T, AllocatorT >::swap().
|
inline |
Exchange the node (plus subgraph) with its sibling node (do nothing if no sibling present).
Definition at line 2213 of file graph.hpp.
References tim::tgraph_node< T >::next_sibling, tim::graph< T, AllocatorT >::iterator_base::node, tim::tgraph_node< T >::parent, and tim::tgraph_node< T >::prev_sibling.
Referenced by tim::graph< T, AllocatorT >::swap().
|
inline |
Replace the range of sibling nodes (plus subgraphs), making these children of the new node.
Definition at line 1554 of file graph.hpp.
References tim::graph< T, AllocatorT >::insert(), and tim::graph< T, AllocatorT >::reparent().
|
inline |
Replace node with a new node, making the old node (plus subgraph) a child of the new node.
Definition at line 1538 of file graph.hpp.
References tim::graph< T, AllocatorT >::insert(), and tim::graph< T, AllocatorT >::reparent().
graph_node* tim::graph< T, AllocatorT >::feet = nullptr |
Definition at line 539 of file graph.hpp.
Referenced by tim::graph< T, AllocatorT >::~graph(), tim::graph< T, AllocatorT >::append_child(), tim::graph< T, AllocatorT >::append_children(), tim::graph< T, AllocatorT >::clear(), tim::graph< T, AllocatorT >::end(), tim::graph< T, AllocatorT >::erase(), tim::graph< T, AllocatorT >::erase_children(), tim::graph< T, AllocatorT >::insert(), tim::graph< T, AllocatorT >::is_valid(), tim::graph< T, AllocatorT >::max_depth(), tim::graph< T, AllocatorT >::move_in(), tim::graph< T, AllocatorT >::move_in_as_nth_child(), tim::graph< T, AllocatorT >::move_out(), tim::graph< T, AllocatorT >::number_of_siblings(), tim::graph< T, AllocatorT >::prepend_child(), tim::graph< T, AllocatorT >::prepend_children(), tim::graph< T, AllocatorT >::reduce(), and tim::graph< T, AllocatorT >::set_head().
graph_node* tim::graph< T, AllocatorT >::head = nullptr |
Definition at line 538 of file graph.hpp.
Referenced by tim::graph< T, AllocatorT >::~graph(), tim::graph< T, AllocatorT >::append_child(), tim::graph< T, AllocatorT >::append_children(), tim::graph< T, AllocatorT >::begin(), tim::graph< T, AllocatorT >::clear(), tim::graph< T, AllocatorT >::erase(), tim::graph< T, AllocatorT >::insert(), tim::graph< T, AllocatorT >::is_valid(), tim::graph< T, AllocatorT >::max_depth(), tim::graph< T, AllocatorT >::move_in(), tim::graph< T, AllocatorT >::move_in_as_nth_child(), tim::graph< T, AllocatorT >::move_out(), tim::graph< T, AllocatorT >::number_of_siblings(), tim::graph< T, AllocatorT >::prepend_child(), tim::graph< T, AllocatorT >::prepend_children(), tim::graph< T, AllocatorT >::replace(), and tim::graph< T, AllocatorT >::set_head().