66 for (
int j = 0; j < n; ++j) {
67 for (
int k = j + 1; k < n; ++k) {
75 bool nodes_resize_policy,
77 bool edges_resize_policy) :
111 for (
const auto& edge:
edges())
112 writer.
edge(edge.first(),
123 for (
const auto node:
nodes) {
EdgeGraphPart(Size edges_size=HashTableConst::default_size, bool edges_resize_policy=true)
default constructor
const EdgeSet & edges() const
returns the set of edges stored within the EdgeGraphPart
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
const NodeGraphPart & nodes() const
return *this as a NodeGraphPart
void writeDotNodes(dot::DotWriter &writer, const dot::DotStyle &style, const dot::DotOptions &options) const
writes the nodes in the dot language, see writeDotNode()
virtual std::string toString() const
a function to display the set of nodes
NodeGraphPart(Size holes_size=HashTableConst::default_size, bool holes_resize_policy=true)
default constructor
bool existsNode(const NodeId id) const
returns true iff the NodeGraphPart contains the given nodeId
virtual void addNodeWithId(const NodeId id)
try to insert a node with the given id
std::vector< NodeId > addNodes(Size n)
insert n nodes
bool contains(const Key &k) const
Indicates whether a given elements belong to the set.
Base class for undirected graphs.
virtual std::string toDot() const
to friendly display graph in DOT format
static UndiGraph completeGraph(int n)
create a complete UndiGraph with n nodes
void addEdge(NodeId first, NodeId second) override
insert a new edge into the undirected graph
~UndiGraph() override
destructor
std::string toString() const override
to friendly display the content of the graph
virtual UndiGraph partialUndiGraph(NodeSet nodes)
returns the partial graph formed by the nodes given in parameter
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
The options given to a toDot(const DotOptions&).
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),...
Writes a graph in the dot language, statement after statement, in the order of the calls.
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).
std::string str() const
The graph written so far, closed. It can be called at any moment, and the writer can be used after.
The statements common to the graphs drawn with graphviz : preamble, attributes of nodes and arcs.
some utils for topology : NodeId, Edge, Arc and consorts ...
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Set< NodeId > NodeSet
Some typdefs and define for shortcuts ...
void writePreamble(DotWriter &writer, const DotStyle &style, const DotOptions &options, std::string_view defaultLabel)
Writes the beginning of a graph, as pyAgrum displays it.
DotAttributes arcAttributes(const DotArcOptions *options)
The attributes of an arc or an edge given by the options : color, penwidth, label,...
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
Generic BFS-based path-finding algorithms for aGrUM graphs.
static DotStyle read()
the style of the graphs of the section notebook
Base classes for undirected graphs.
Inline implementation of Base classes for undirected graphs.