47#ifndef GUM_DOT_WRITER_H
48#define GUM_DOT_WRITER_H
107 explicit DotWriter(
bool directed =
true, std::string_view name =
"");
131 void edge(std::string_view from, std::string_view to,
const DotAttributes& attributes = {});
149 std::string
str()
const;
156 static std::string
quote(std::string_view text);
159 static std::string
number(
double value);
168 std::string _indent_()
const;
170 static std::string _attributes_(
const DotAttributes& attributes);
172 static std::string _attribute_(
const DotAttribute& attribute);
174 void _defaults_(
const char* keyword,
const DotAttributes& attributes);
176 void _node_(
const std::string&
id,
const DotAttributes& attributes);
177 void _edge_(
const std::string& from,
const std::string& to,
const DotAttributes& attributes);
void nodeDefaults(const DotAttributes &attributes)
node [attributes];, the default attributes of the nodes that follow (none : does nothing).
void graphAttributes(const DotAttributes &attributes)
graph [attributes];, the attributes of the graph (does nothing if there is none).
void edgeDefaults(const DotAttributes &attributes)
edge [attributes];, the default attributes of the edges that follow (none : does nothing).
void edge(std::string_view from, std::string_view to, const DotAttributes &attributes={})
an edge from from to to (-> in a directed graph, -- in an undirected one).
void endSubgraph()
Closes the last subgraph that is open.
static std::string number(double value)
The shortest text that reads back as value (0.5, 1, 1e-05).
DotWriter(bool directed=true, std::string_view name="")
Starts a graph.
static std::string quote(std::string_view text)
text between double quotes, in which ", \, line feed and carriage return are escaped.
std::string str() const
The graph written so far, closed. It can be called at any moment, and the writer can be used after.
void node(std::string_view id, const DotAttributes &attributes={})
a node, whose identifier is id (quoted).
void beginSubgraph(std::string_view name, const DotAttributes &attributes={})
Opens a subgraph : subgraph "name" { key="value"; ... .
void graphAttribute(const DotAttribute &attribute)
key="value";, an attribute of the graph or of the subgraph being written.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
std::vector< DotAttribute > DotAttributes
a list of attributes
An attribute of a graph, a node or an edge : key="value".