1 #ifndef RDFAnalysis_Utils_BoostGraphBuilder_H 2 #define RDFAnalysis_Utils_BoostGraphBuilder_H 4 #include <boost/graph/adjacency_list.hpp> 28 template <
typename InputNode,
30 typename ChildItr=
typename std::vector<std::decay_t<InputNode>>::const_iterator>
50 using graph_t = boost::adjacency_list<
51 boost::vecS, boost::vecS, boost::directedS,
Vertex>;
53 using vert_desc_t =
typename boost::graph_traits<graph_t>::vertex_descriptor;
55 using prop_map_t =
typename boost::property_map<graph_t, vertex_info_t Vertex::*>::type;
63 std::function<ChildItr(InputNode)> childBegin,
64 std::function<ChildItr(InputNode)> childEnd);
76 virtual VertexInfo
info(InputNode input) = 0;
101 #include "RDFAnalysis/Utils/BoostGraphBuilder.icc" 103 #endif //> !RDFAnalysis_Utils_BoostGraphBuilder_H VertexInfo info
The information attached to a vertex.
Definition: BoostGraphBuilder.h:40
NodeDecision
Enum to describe what should be done with a node.
Definition: BoostGraphBuilder.h:79
Vertex()
Default construct the vertex.
Definition: BoostGraphBuilder.h:36
void addToGraph(InputNode input, const vert_desc_t &parent, graph_t &graph)
Add a node into the graph.
virtual ~BoostGraphBuilder()=0
std::function< ChildItr(InputNode)> m_childBegin
Get the start of a node's children.
Definition: BoostGraphBuilder.h:95
virtual NodeDecision processNode(InputNode input)
Choose whether or not to add a node to a graph.
InputNode input_node_t
The input node type.
Definition: BoostGraphBuilder.h:44
Definition: CutflowDetail.h:11
boost::adjacency_list< boost::vecS, boost::vecS, boost::directedS, Vertex > graph_t
The BGL graph type.
Definition: BoostGraphBuilder.h:51
Class to build Boost Graph Library graphs from a recursive tree structure.
Definition: BoostGraphBuilder.h:31
std::function< ChildItr(InputNode)> m_childEnd
Get the end of a node's children.
Definition: BoostGraphBuilder.h:97
VertexInfo vertex_info_t
The vertex info type.
Definition: BoostGraphBuilder.h:46
typename boost::property_map< graph_t, vertex_info_t Vertex::* >::type prop_map_t
The BGL property map type.
Definition: BoostGraphBuilder.h:55
BoostGraphBuilder(std::function< ChildItr(InputNode)> childBegin, std::function< ChildItr(InputNode)> childEnd)
Create the builder.
ChildItr child_itr_t
The child iterator type.
Definition: BoostGraphBuilder.h:48
graph_t buildGraph(InputNode root)
Build the graph.
typename boost::graph_traits< graph_t >::vertex_descriptor vert_desc_t
The BGL vertex type.
Definition: BoostGraphBuilder.h:53
Vertex(const VertexInfo &info)
Construct the vertex from its info.
Definition: BoostGraphBuilder.h:38
The vertex struct.
Definition: BoostGraphBuilder.h:34