57 bool nodes_resize_policy,
59 bool arcs_resize_policy,
61 bool edges_resize_policy) :
66 DiGraph(arcs_size, arcs_resize_policy) {
102 std::stringstream output;
103 std::stringstream nodeStream;
104 std::stringstream edgeStream;
108 output <<
"digraph \"no_name\" {\n";
109 nodeStream <<
"node [shape = ellipse];\n";
110 std::string tab =
" ";
112 for (
const auto node:
nodes()) {
113 nodeStream << std::format(
"{}{}{};", tab, node,
dotNodeLabel(node));
116 if (!treatedNodes.
exists(nei))
117 edgeStream << std::format(
"{}{} -> {} [dir=none];\n", tab, node, nei);
119 for (
const auto chi:
children(node))
120 edgeStream << std::format(
"{}{} -> {};\n", tab, node, chi);
122 treatedNodes.
insert(node);
125 output << nodeStream.str() <<
'\n' << edgeStream.str() <<
'\n' <<
"}\n";
NodeSet children(const NodeSet &ids) const
returns the set of nodes which consists in the node and its parents returns the set of children of a ...
std::string toString() const
to friendly display the content of the ArcGraphPart
DiGraph(Size nodes_size=HashTableConst::default_size, bool nodes_resize_policy=true, Size arcs_size=HashTableConst::default_size, bool arcs_resize_policy=true)
default constructor
virtual std::string toString() const
to friendly display the content of the EdgeGraphPart
const NodeSet & neighbours(NodeId id) const
returns the set of node neighbours to a given node
Base class for mixed graphs.
std::string toString() const override
to friendly display the content of the MixedGraph
std::string toDot() const override
to friendly display mixed graph in DOT format
MixedGraph(Size nodes_size=HashTableConst::default_size, bool nodes_resize_policy=true, Size arcs_size=HashTableConst::default_size, bool arcs_resize_policy=true, Size edges_size=HashTableConst::default_size, bool edges_resize_policy=true)
default constructor
~MixedGraph() override
destructor
Class for node sets in graph.
const NodeGraphPart & nodes() const
return *this as a NodeGraphPart
virtual std::string toString() const
a function to display the set of nodes
std::string dotNodeLabel(NodeId id) const
returns " [label=\"...\"]" with DOT-escaped name, or "" if no name
bool exists(const Key &k) const
Indicates whether a given elements belong to the set.
void insert(const Key &k)
Inserts a new element into the set.
UndiGraph(Size nodes_size=HashTableConst::default_size, bool nodes_resize_policy=true, Size edges_size=HashTableConst::default_size, bool edges_resize_policy=true)
default constructor
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Set< NodeId > NodeSet
Some typdefs and define for shortcuts ...
Base classes for mixed directed/undirected graphs.
Inline implementation of Base classes for mixed graphs.
gum is the global namespace for all aGrUM entities
std::ostream & operator<<(std::ostream &stream, const AVLTree< Val, Cmp > &tree)
display the content of a tree