20std::shared_ptr<GraphDrawing::GraphNode>
22 std::unordered_map<
void *, std::shared_ptr<GraphNode>> &visitedMap)
26 auto duplicateDefineIt = visitedMap.find((
void *)columnPtr);
27 if (duplicateDefineIt != visitedMap.end())
28 return duplicateDefineIt->second;
30 auto node = std::make_shared<GraphNode>(
"Define\\n" + columnName, visitedMap.size(), ENodeType::kDefine);
31 visitedMap[(
void *)columnPtr] = node;
35std::shared_ptr<GraphDrawing::GraphNode>
37 std::unordered_map<
void *, std::shared_ptr<GraphNode>> &visitedMap)
40 auto duplicateFilterIt = visitedMap.find((
void *)filterPtr);
41 if (duplicateFilterIt != visitedMap.end()) {
42 duplicateFilterIt->second->SetNotNew();
43 return duplicateFilterIt->second;
46 auto node = std::make_shared<GraphNode>((filterPtr->
HasName() ? filterPtr->
GetName() :
"Filter"), visitedMap.size(),
48 visitedMap[(
void *)filterPtr] = node;
52std::shared_ptr<GraphDrawing::GraphNode>
54 std::unordered_map<
void *, std::shared_ptr<GraphNode>> &visitedMap)
57 auto duplicateRangeIt = visitedMap.find((
void *)rangePtr);
58 if (duplicateRangeIt != visitedMap.end()) {
59 duplicateRangeIt->second->SetNotNew();
60 return duplicateRangeIt->second;
63 auto node = std::make_shared<GraphNode>(
"Range", visitedMap.size(), ENodeType::kRange);
64 visitedMap[(
void *)rangePtr] = node;
68std::shared_ptr<GraphDrawing::GraphNode>
70 const std::vector<std::string> &prevNodeDefines,
71 std::unordered_map<
void *, std::shared_ptr<GraphNode>> &visitedMap)
73 auto upmostNode = node;
75 for (
auto i =
int(defineNames.size()) - 1; i >= 0; --i) {
76 const auto colName = defineNames[i];
77 const bool isAlias = colRegister.
IsAlias(colName);
80 const bool isANewDefine =
81 std::find(prevNodeDefines.begin(), prevNodeDefines.end(), colName) == prevNodeDefines.end();
88 upmostNode->SetPrevNode(defineNode);
89 upmostNode = defineNode;
95namespace GraphDrawing {
100 std::stringstream dotStringLabels;
102 std::stringstream dotStringGraph;
107 dotStringLabels <<
"\t" << leaf->
GetID() <<
" [label=\"" << leaf->
GetName()
108 <<
"\", style=\"filled\", fillcolor=\"" << leaf->
GetColor() <<
"\", shape=\"" << leaf->
GetShape()
116 return "digraph {\n" + dotStringLabels.str() + dotStringGraph.str() +
"}";
122 std::stringstream dotStringLabels;
124 std::stringstream dotStringGraph;
126 for (
auto leafShPtr : leaves) {
129 dotStringLabels <<
"\t" << leaf->
GetID() <<
" [label=\"" << leaf->
GetName()
130 <<
"\", style=\"filled\", fillcolor=\"" << leaf->
GetColor() <<
"\", shape=\""
140 return "digraph {\n" + dotStringLabels.str() + dotStringGraph.str() +
"}";
157 std::vector<std::shared_ptr<GraphNode>> nodes;
158 nodes.reserve(actions.size() + edges.size());
160 for (
auto *action : actions)
162 for (
auto *edge : edges)
std::string GetName() const
The head node of a RDF computation graph.
std::vector< RDFInternal::RActionBase * > GetAllActions() const
Return all actions, either booked or already run.
std::vector< RNodeBase * > GetGraphEdges() const
Return all graph edges known to RLoopManager This includes Filters and Ranges but not Defines.
void Jit()
Add RDF nodes that require just-in-time compilation to the computation graph.
std::string FromGraphLeafToDot(const GraphNode &leaf) const
Starting from any leaf (Action, Filter, Range) it draws the dot representation of the branch.
std::string RepresentGraph(ROOT::RDataFrame &rDataFrame)
Starting from the root node, prints the entire graph.
std::string FromGraphActionsToDot(std::vector< std::shared_ptr< GraphNode > > leaves) const
Starting by an array of leaves, it draws the entire graph.
std::unordered_map< void *, std::shared_ptr< GraphNode > > fVisitedMap
Map to keep track of visited nodes when constructing the computation graph (SaveGraph)
Class used to create the operation graph to be printed in the dot representation.
void SetExplored()
Allows to stop the graph traversal when an explored node is encountered.
std::string GetColor() const
std::string GetShape() const
std::string GetName() const
unsigned int GetID() const
GraphNode * GetPrevNode() const
A binder for user-defined columns, variations and aliases.
std::vector< std::string_view > GenerateColumnNames() const
Return the list of the names of the defined columns (Defines + Aliases).
bool IsAlias(std::string_view name) const
Return true if the given column name is an existing alias.
RDFDetail::RDefineBase * GetDefine(std::string_view colName) const
Return the RDefine for the requested column name, or nullptr.
RDFDetail::RLoopManager * GetLoopManager() const
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...
std::shared_ptr< GraphNode > CreateFilterNode(const ROOT::Detail::RDF::RFilterBase *filterPtr, std::unordered_map< void *, std::shared_ptr< GraphNode > > &visitedMap)
std::shared_ptr< GraphNode > CreateRangeNode(const ROOT::Detail::RDF::RRangeBase *rangePtr, std::unordered_map< void *, std::shared_ptr< GraphNode > > &visitedMap)
std::shared_ptr< GraphNode > AddDefinesToGraph(std::shared_ptr< GraphNode > node, const RColumnRegister &colRegister, const std::vector< std::string > &prevNodeDefines, std::unordered_map< void *, std::shared_ptr< GraphNode > > &visitedMap)
std::shared_ptr< GraphNode > CreateDefineNode(const std::string &columnName, const ROOT::Detail::RDF::RDefineBase *columnPtr, std::unordered_map< void *, std::shared_ptr< GraphNode > > &visitedMap)
bool IsInternalColumn(std::string_view colName)
Whether custom column with name colName is an "internal" column such as rdfentry_ or rdfslot_.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...