Free-form topology#
New in version 2.15.
#include <pagmo/topologies/free_form.hpp>
-
class free_form : public base_bgl_topology#
This user-defined topology (UDT) represents a graph in which vertices and edges can be manipulated freely. It is implemented as a simple extension of
base_bgl_topology
in which thepush_back()
function adds a vertex without connections.-
free_form()#
Default constructor.
The default constructor initialises an empty topology.
-
explicit free_form(bgl_graph_t g)#
Constructor from a
bgl_graph_t
.The internal graph of the topology will be set to g.
- Parameters
g – the graph that will be used to initialise
this
.- Throws
std::invalid_argument – if any edge in the graph has a weight outside the \(\left[ 0, 1 \right]\) range.
-
template<typename T>
explicit free_form(const T &t)# Note
The constructor from
T
does not participate in overload resolution ifT
isfree_form
or ifT
does not satisfyis_udt
.Constructors from a
topology
or a UDT.These constructors will first invoke the
pagmo::topology::to_bgl()
function to extract a graph representation of the inputtopology
or UDT, and will then use that graph object to initialise thisfree_form
object via the constructor frombgl_graph_t
.In other words, these constructors allow to copy the graph of a
topology
or a UDT intothis
.- Parameters
t – the input
topology
or UDT.- Throws
unspecified – any exception raised by the construction of a
topology
object, the invocation of thepagmo::topology::to_bgl()
function or by the constructor frombgl_graph_t
.
-
void push_back()#
Add a new vertex.
The newly-added vertex will not be connected to any other vertex.
- Throws
unspecified – any exception thrown by the public API of
base_bgl_topology
.
-
std::string get_name() const#
Get the name of the topology.
- Returns
"Free form"
.
-
free_form()#