halcheck 1.0
Loading...
Searching...
No Matches
halcheck::lib::dag< T > Class Template Reference

Directed acyclic graphs with labelled nodes. More...

#include <dag.hpp>

Public Types

using value_type = T
 The type of node labels.
 
using iterator = lib::index_iterator<std::vector<T>>
 A iterator to T. These are also referred to as "nodes".
 
using const_iterator = lib::index_iterator<const std::vector<T>>
 An iterator to const T. These are also referred to as "nodes".
 
using view = lib::transform_view<lib::ref_view<const std::vector<std::size_t>>, to_iterator>
 A collection of iterators.
 
using const_view = lib::transform_view<lib::ref_view<const std::vector<std::size_t>>, to_const_iterator>
 A collection of const_iterators.
 

Public Member Functions

template<typename R , typename F >
 dag (R &&range, F func)
 
iterator begin ()
 Gets an iterator pointing to the first node in this dag.
 
const_iterator begin () const
 Gets an const_iterator pointing to the first node in this dag.
 
iterator end ()
 Gets an iterator pointing past the last node in this dag.
 
const_iterator end () const
 Gets an const_iterator pointing past the last node in this dag.
 
bool empty () const
 Determines whether this dag is empty.
 
std::size_t size () const
 Gets the number of nodes in this dag.
 
template<typename I , typename... Args>
iterator emplace (I first, I last, Args &&...args)
 Adds a node to this dag with its label constructed in place.
 
template<typename R , typename... Args>
iterator emplace (R &&range, Args &&...args)
 Adds a node to this dag with its label constructed in place.
 
template<typename... Args>
iterator emplace (const std::initializer_list< const_iterator > &range, Args &&...args)
 Adds a node to this dag with its label constructed in place.
 
void clear ()
 Removes all nodes from this dag.
 
const_view children (const_iterator it) const
 Obtains a node's children.
 
view children (const_iterator it)
 Obtains a node's children.
 
const_view parents (const_iterator it) const
 Obtains a node's parents.
 
view parents (const_iterator it)
 Obtains a node's parents.
 
const_view roots () const
 Obtains the root nodes of this dag.
 
view roots ()
 Obtains the root nodes of this dag.
 
void reserve (std::size_t size)
 Reserves enough memory to contain the specified number of nodes.
 

Detailed Description

template<typename T>
class halcheck::lib::dag< T >

Directed acyclic graphs with labelled nodes.

Template Parameters
TThe type of node label.

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