88 const std::string& key,
89 const std::string& value,
91 _nodes_[
node].attributes.push_back({key, value, verbatim});
96 return it ==
_nodes_.end() ? nullptr : &it->second;
100 _arcs_[{tail, head}].color = color;
104 if (!std::isfinite(width) || width < 0) {
106 "The width of an arc must be a finite number, at least 0 (not " << width <<
").")
108 _arcs_[{tail, head}].width = width;
116 _arcs_[{tail, head}].tooltip = tooltip;
121 const std::string& key,
122 const std::string& value,
124 _arcs_[{tail, head}].attributes.push_back({key, value, verbatim});
128 const auto it =
_arcs_.find({tail, head});
129 return it ==
_arcs_.end() ? nullptr : &it->second;
133 if (
const auto* options =
arc(a, b))
return options;
138 std::sort(variables.begin(), variables.end());
139 variables.erase(std::unique(variables.begin(), variables.end()), variables.end());
144 const std::string& color) {
149 const std::string& color) {
158 const std::string& tooltip) {
163 const std::string& key,
164 const std::string& value,
166 _factors_[
_key_(variables)].attributes.push_back({key, value, verbatim});
171 return it ==
_factors_.end() ? nullptr : &it->second;
Exception: at least one argument passed to a function is not what was expected.
void setArcColor(Size tail, Size head, const std::string &color)
std::map< std::pair< Size, Size >, DotArcOptions > _arcs_
void setRankDir(const std::string &rankDir)
direction of the layout, TB or LR
void setNodeAttribute(Size node, const std::string &key, const std::string &value, bool verbatim=false)
any other attribute of the node ; written as is if verbatim, see DotAttribute
void setFactorTooltip(const std::vector< Size > &variables, const std::string &tooltip)
any other attribute of the node of the factor ; written as is if verbatim, see DotAttribute
const std::string & layout() const
direction of the layout, TB or LR
void setArcWidth(Size tail, Size head, double width)
void setArcAttribute(Size tail, Size head, const std::string &key, const std::string &value, bool verbatim=false)
any other attribute of the arc ; written as is if verbatim, see DotAttribute
void setNodeBgColor(Size node, const std::string &color)
any other attribute of the node ; written as is if verbatim, see DotAttribute
void setFactorAttribute(const std::vector< Size > &variables, const std::string &key, const std::string &value, bool verbatim=false)
any other attribute of the node of the factor ; written as is if verbatim, see DotAttribute
const std::string & label() const
direction of the layout, TB or LR
const std::string & size() const
direction of the layout, TB or LR
const DotArcOptions * arc(Size tail, Size head) const
the options of the arc from tail to head, or nullptr if none was given for it
std::map< std::vector< Size >, DotNodeOptions > _factors_
void setArcTooltip(Size tail, Size head, const std::string &tooltip)
void setLabel(const std::string &label)
label of the graph (by default, the name of the graph if it has one)
std::map< Size, DotNodeOptions > _nodes_
void setNodeTooltip(Size node, const std::string &tooltip)
any other attribute of the node ; written as is if verbatim, see DotAttribute
void setSize(const std::string &size)
direction of the layout, TB or LR
void setFactorFgColor(const std::vector< Size > &variables, const std::string &color)
any other attribute of the node of the factor ; written as is if verbatim, see DotAttribute
bool empty() const
true if nothing was given
const DotArcOptions * edge(Size a, Size b) const
the options of the undirected edge between a and b, given for (a, b) or for (b, a),...
static std::vector< Size > _key_(std::vector< Size > variables)
void setLayout(const std::string &layout)
graphviz layout engine
void setNodeFgColor(Size node, const std::string &color)
any other attribute of the node ; written as is if verbatim, see DotAttribute
const std::string & rankDir() const
direction of the layout, TB or LR
const DotNodeOptions * factor(const std::vector< Size > &variables) const
the options of the factor on these variables (in any order), or nullptr if none was given
const DotNodeOptions * node(Size node) const
the options of a node, or nullptr if none was given for it
void setFactorBgColor(const std::vector< Size > &variables, const std::string &color)
any other attribute of the node of the factor ; written as is if verbatim, see DotAttribute
void setArcLabel(Size tail, Size head, const std::string &label)
void setFactorLabel(const std::vector< Size > &variables, const std::string &label)
any other attribute of the node of the factor ; written as is if verbatim, see DotAttribute
void setNodeLabel(Size node, const std::string &label)
any other attribute of the node ; written as is if verbatim, see DotAttribute
What the caller gives to a toDot() beyond the configuration: sizes, labels, colors of some nodes and ...
#define GUM_ERROR(type, msg)
std::size_t Size
In aGrUM, hashed values are unsigned long int.
the options of an arc or an edge : an empty text (no value for the width) means "not given"
the options of a node : an empty text means "not given", so that the value of the configuration is us...