![]() |
Version: 1.0 |
A BinaryDrag is the GRAPHGEN implementation of a Binary Directed Rooted Acyclic Graph (DRAG in short) More...
#include <drag.h>
Classes | |
struct | node |
Defines a node of the BinaryDrag. More... | |
Public Member Functions | |
template<typename... Args> | |
node * | make_node (Args &&... args) |
Creates and returns a new node updating the nodes_ vector. More... | |
void | AddRoot (node *r) |
Adds a new root to the vector of roots. More... | |
node * | GetRoot () const |
Returns the last root of the BinaryDrag. More... | |
node * | MakeCopyRecursive (node *n, std::unordered_map< node *, node * > &copies) |
Recursive function to copy a BinaryDrag. More... | |
BinaryDrag () | |
Empty constructor. More... | |
BinaryDrag (const BinaryDrag &bd) | |
Copy constructor. More... | |
BinaryDrag (const BinaryDrag &bd, std::vector< node * > &tracked_nodes) | |
Special copy constructor that allows to track where the nodes in a tree have been copied to. More... | |
BinaryDrag (BinaryDrag &&t) | |
BinaryDrag & | operator= (BinaryDrag t) |
Copy assignment. More... | |
node * | make_root () |
Creates a new root updating the roots_ vector. More... | |
Public Attributes | |
std::vector< std::unique_ptr< node > > | nodes_ |
Vector of unique pointers to BinaryDrag nodes. This is useful to automatically free the memory of the BinaryDrag, without requiring a recursive exploration of its structure. More... | |
std::vector< node * > | roots_ |
Friends | |
void | swap (BinaryDrag &bd1, BinaryDrag &bd2) |
A BinaryDrag is the GRAPHGEN implementation of a Binary Directed Rooted Acyclic Graph (DRAG in short)
The implementation A BinaryDrag is template on the node data type. A BinaryDrag can be used to model/implement a simple binary tree, a multi-rooted binary tree, a directed acyclic graph with just one root, or a multi-rooted drag. A BinareDrag is the core data structure of GRAPHGEN.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Returns the last root of the BinaryDrag.
|
inline |
|
inline |
|
inline |
Recursive function to copy a BinaryDrag.
This member function is also required by the copy constructor.
[in] | n | The node address of the BinaryDrag from which start the recursive copy |
[in,out] | copies | Maps every node address to be copied with its copy address. |
|
inline |
|
friend |
std::vector<std::unique_ptr<node> > BinaryDrag< T >::nodes_ |
Vector of unique pointers to BinaryDrag nodes. This is useful to automatically free the memory of the BinaryDrag, without requiring a recursive exploration of its structure.
std::vector<node *> BinaryDrag< T >::roots_ |