1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
Ring
====
.. versionadded:: 2.11
*#include <pagmo/topologies/ring.hpp>*
.. image:: ../../images/ring.png
.. cpp:namespace-push:: pagmo
.. cpp:class:: ring: public base_bgl_topology
This user-defined topology (UDT) represents a bidirectional ring (that is, a ring
in which each node connects to both the previous and the following nodes).
.. cpp:function:: ring()
Default constructor.
Equivalent to the constructor from edge weight with *w* = 1.
.. cpp:function:: explicit ring(double w)
Constructor from edge weight.
New edges created via :cpp:func:`~pagmo::ring::push_back()` will have
a weight of *w*.
:param w: the weight of the edges.
:exception std\:\:invalid_argument: if *w* is not in the :math:`\left[0, 1\right]` range.
.. cpp:function:: explicit ring(std::size_t n, double w)
Constructor from number of vertices and edge weight.
This constructor will initialise a ring topology with *n* vertices and whose
edges will have a weight of *w*.
New edges created via subsequent :cpp:func:`~pagmo::ring::push_back()` calls
will also have a weight of *w*.
:param n: the desired number of vertices.
:param w: the weight of the edges.
:exception std\:\:invalid_argument: if *w* is not in the :math:`\left[0, 1\right]` range.
:exception unspecified: any exception thrown by :cpp:func:`~pagmo::ring::push_back()`.
.. cpp:function:: void push_back()
Add the next vertex.
:exception unspecified: any exception thrown by the public API of :cpp:class:`~pagmo::base_bgl_topology`.
.. cpp:function:: double get_weight() const
:return: the weight *w* used when constructing this topology.
.. cpp:function:: std::string get_name() const
Get the name of the topology.
:return: ``"Ring"``.
.. cpp:namespace-pop::
|