RDFAnalysis  0.1.1
Physics analysis with ROOT::RDataFrame
BoostGraphBuilder< InputNode, VertexInfo, ChildItr > Class Template Referenceabstract

Class to build Boost Graph Library graphs from a recursive tree structure. More...

#include <BoostGraphBuilder.h>

Data Structures

struct  Vertex
 The vertex struct. More...
 

Public Types

using input_node_t = InputNode
 The input node type. More...
 
using vertex_info_t = VertexInfo
 The vertex info type. More...
 
using child_itr_t = ChildItr
 The child iterator type. More...
 
using graph_t = boost::adjacency_list< boost::vecS, boost::vecS, boost::directedS, Vertex >
 The BGL graph type. More...
 
using vert_desc_t = typename boost::graph_traits< graph_t >::vertex_descriptor
 The BGL vertex type. More...
 
using prop_map_t = typename boost::property_map< graph_t, vertex_info_t Vertex::* >::type
 The BGL property map type. More...
 

Public Member Functions

 BoostGraphBuilder (std::function< ChildItr(InputNode)> childBegin, std::function< ChildItr(InputNode)> childEnd)
 Create the builder. More...
 
virtual ~BoostGraphBuilder ()=0
 
graph_t buildGraph (InputNode root)
 Build the graph. More...
 

Protected Types

enum  NodeDecision { Write, Skip, Terminate }
 Enum to describe what should be done with a node. More...
 

Protected Member Functions

virtual VertexInfo info (InputNode input)=0
 Create a vertex info from an input node. More...
 
virtual NodeDecision processNode (InputNode input)
 Choose whether or not to add a node to a graph. More...
 
void addToGraph (InputNode input, const vert_desc_t &parent, graph_t &graph)
 Add a node into the graph. More...
 

Protected Attributes

std::function< ChildItr(InputNode)> m_childBegin
 Get the start of a node's children. More...
 
std::function< ChildItr(InputNode)> m_childEnd
 Get the end of a node's children. More...
 

Detailed Description

template<typename InputNode, typename VertexInfo, typename ChildItr = typename std::vector<std::decay_t<InputNode>>::const_iterator>
class RDFAnalysis::detail::BoostGraphBuilder< InputNode, VertexInfo, ChildItr >

Class to build Boost Graph Library graphs from a recursive tree structure.

Template Parameters
InputNodeThe type of the nodes in the tree
VertexInfoThe type of info to attach to each vertex. Must be default constructible and copy constructible
ChildItrThe type of iterator used to iterate over child nodes

Right now this class only allows for customising the vertices of the ouptut graph. If necessary it could be extended to write extra information to the edges.

Member Typedef Documentation

using child_itr_t = ChildItr

The child iterator type.

using graph_t = boost::adjacency_list< boost::vecS, boost::vecS, boost::directedS, Vertex>

The BGL graph type.

using input_node_t = InputNode

The input node type.

using prop_map_t = typename boost::property_map<graph_t, vertex_info_t Vertex::*>::type

The BGL property map type.

using vert_desc_t = typename boost::graph_traits<graph_t>::vertex_descriptor

The BGL vertex type.

using vertex_info_t = VertexInfo

The vertex info type.

Member Enumeration Documentation

enum NodeDecision
strongprotected

Enum to describe what should be done with a node.

Enumerator
Write 
Skip 
Terminate 

Constructor & Destructor Documentation

BoostGraphBuilder ( std::function< ChildItr(InputNode)>  childBegin,
std::function< ChildItr(InputNode)>  childEnd 
)

Create the builder.

Parameters
childBeginFunction to get the start of a node's children
childEndFunction to get the end of a node's children
virtual ~BoostGraphBuilder ( )
pure virtual

Member Function Documentation

void addToGraph ( InputNode  input,
const vert_desc_t parent,
graph_t graph 
)
protected

Add a node into the graph.

graph_t buildGraph ( InputNode  root)

Build the graph.

Parameters
rootThe root node of the input tree.
virtual VertexInfo info ( InputNode  input)
protectedpure virtual

Create a vertex info from an input node.

virtual NodeDecision processNode ( InputNode  input)
protectedvirtual

Choose whether or not to add a node to a graph.

Field Documentation

std::function<ChildItr(InputNode)> m_childBegin
protected

Get the start of a node's children.

std::function<ChildItr(InputNode)> m_childEnd
protected

Get the end of a node's children.


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