graph_analysis
Public Member Functions | List of all members
graph_analysis::percolation::strategies::RandomDraw Class Reference

Randomly draws items from a given set, based on given probability densities. Uses RandomNumberGenerator internally, see RandomNumberGenerator for parametrization of seed and algorithms. More...

#include <RandomDraw.hpp>

Public Member Functions

 RandomDraw (uint32_t seed=0)
 
 ~RandomDraw ()
 
void setProbabilityDensity (GraphElementId id, double density)
 
double getProbabilityDensitySum () const
 
double getProbability (GraphElementId id) const
 
void removeItem (GraphElementId id)
 
GraphElementId drawItem () const
 

Detailed Description

Randomly draws items from a given set, based on given probability densities. Uses RandomNumberGenerator internally, see RandomNumberGenerator for parametrization of seed and algorithms.

See also
RandomNumberGenerator

Constructor & Destructor Documentation

◆ RandomDraw()

graph_analysis::percolation::strategies::RandomDraw::RandomDraw ( uint32_t  seed = 0)
Parameters
seedIf set to 0 will use a random seed, otherwise argument is passed as seed to srand()

◆ ~RandomDraw()

graph_analysis::percolation::strategies::RandomDraw::~RandomDraw ( )

Member Function Documentation

◆ drawItem()

GraphElementId graph_analysis::percolation::strategies::RandomDraw::drawItem ( ) const

Draw an item from the known set of elements

Returns
id of the drawn item

◆ getProbability()

double graph_analysis::percolation::strategies::RandomDraw::getProbability ( GraphElementId  id) const

Get the probability for drawing the given element

Returns
probability for drawing the element

◆ getProbabilityDensitySum()

double graph_analysis::percolation::strategies::RandomDraw::getProbabilityDensitySum ( ) const

Get probability density

Returns
the overall sum of probability densities

◆ removeItem()

void graph_analysis::percolation::strategies::RandomDraw::removeItem ( GraphElementId  id)

Remove an item

◆ setProbabilityDensity()

void graph_analysis::percolation::strategies::RandomDraw::setProbabilityDensity ( GraphElementId  id,
double  density 
)

Set probability density

Parameters
idGraphElementId for which the density should be set
densityDensity for the element id

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