anpcpp 0.1.0
Analytic Network Process computational library
Loading...
Searching...
No Matches
Public Member Functions | List of all members
anpcpp::AnpCluster Class Reference

A group of nodes (and cluster-level pairwise comparisons). More...

#include <network.hpp>

Public Member Functions

 AnpCluster (AnpNetwork *network, std::string name)
 Constructs a cluster (normally via AnpNetwork::add_cluster).
 
const std::string & name () const noexcept
 
const std::string & description () const noexcept
 
void set_description (std::string description)
 Sets cluster description.
 
AnpNetworknetwork () const noexcept
 
std::size_t nnodes () const noexcept
 
AnpNodeadd_node (const std::string &name)
 Adds a node to this cluster.
 
void move_node (const std::string &name, std::size_t new_index)
 Reorders a node within this cluster (preserves pairwise data).
 
AnpNodefind_node (const std::string &name)
 
const AnpNodefind_node (const std::string &name) const
 Const overload of find_node.
 
AnpNodenode (const std::string &name)
 
const AnpNodenode (const std::string &name) const
 Const overload of node.
 
std::vector< std::string > node_names () const
 
std::vector< AnpNode * > nodes ()
 
std::vector< const AnpNode * > nodes () const
 
void cluster_connect (AnpCluster *dest)
 Connects this cluster to dest (enables cluster pairwise).
 
PairwiseJudgmentscluster_pairwise ()
 
const PairwiseJudgmentscluster_pairwise () const
 Const overload of cluster_pairwise.
 

Detailed Description

A group of nodes (and cluster-level pairwise comparisons).

Constructor & Destructor Documentation

◆ AnpCluster()

anpcpp::AnpCluster::AnpCluster ( AnpNetwork network,
std::string  name 
)

Constructs a cluster (normally via AnpNetwork::add_cluster).

Parameters
networkOwning network.
nameCluster name (unique within the network).

Member Function Documentation

◆ add_node()

AnpNode & anpcpp::AnpCluster::add_node ( const std::string &  name)

Adds a node to this cluster.

Exceptions
std::runtime_errorif the name already exists in the network.

◆ cluster_pairwise()

PairwiseJudgments & anpcpp::AnpCluster::cluster_pairwise ( )
inline
Returns
Cluster-level pairwise judgments.

◆ description()

const std::string & anpcpp::AnpCluster::description ( ) const
inlinenoexcept
Returns
Optional description.

◆ find_node()

AnpNode * anpcpp::AnpCluster::find_node ( const std::string &  name)
Returns
Pointer to node or nullptr.

◆ move_node()

void anpcpp::AnpCluster::move_node ( const std::string &  name,
std::size_t  new_index 
)

Reorders a node within this cluster (preserves pairwise data).

Parameters
nameNode to move.
new_indexTarget 0-based index.

◆ name()

const std::string & anpcpp::AnpCluster::name ( ) const
inlinenoexcept
Returns
Cluster name.

◆ network()

AnpNetwork * anpcpp::AnpCluster::network ( ) const
inlinenoexcept
Returns
Owning network.

◆ nnodes()

std::size_t anpcpp::AnpCluster::nnodes ( ) const
inlinenoexcept
Returns
Number of nodes in this cluster.

◆ node()

AnpNode & anpcpp::AnpCluster::node ( const std::string &  name)
Returns
Reference to named node.
Exceptions
std::out_of_rangeif not found.

◆ node_names()

std::vector< std::string > anpcpp::AnpCluster::node_names ( ) const
Returns
Names of nodes in cluster order.

◆ nodes() [1/2]

std::vector< AnpNode * > anpcpp::AnpCluster::nodes ( )
Returns
Mutable pointers to nodes in order.

◆ nodes() [2/2]

std::vector< const AnpNode * > anpcpp::AnpCluster::nodes ( ) const
Returns
Const node pointers in order.

The documentation for this class was generated from the following file: