girgs  1.0.2
Generator for Geometric Inhomogeneous Random Graphs
Functions
girgs Namespace Reference

Functions

GIRGS_API std::vector< double > generateWeights (int n, double ple, int weightSeed, bool parallel=true)
 The weights are sampled according to a power law distribution between [1, n) More...
 
GIRGS_API std::vector< std::vector< double > > generatePositions (int n, int dimension, int positionSeed, bool parallel=true)
 Samples d dimensional coordinates for n points on a torus \([0,1)^d\). More...
 
GIRGS_API double scaleWeights (std::vector< double > &weights, double desiredAvgDegree, int dimension, double alpha)
 Scales all weights so that the expected average degree equals desiredAvgDegree. Implemented as binary search over an estimation function. More...
 
GIRGS_API std::vector< std::pair< int, int > > generateEdges (const std::vector< double > &weights, const std::vector< std::vector< double >> &positions, double alpha, int samplingSeed)
 Samples edges according to weights and positions. An edge between node u and v is formed with probability \( \left(\frac{w_u w_v / W}{|| x_u - x_v ||^d}\right)^\alpha \) or 1.0 if the term exceeds 1.0. More...
 
GIRGS_API void saveDot (const std::vector< double > &weights, const std::vector< std::vector< double >> &positions, const std::vector< std::pair< int, int >> &graph, const std::string &file)
 Saves the graph in .dot format (graphviz). The weight is saved as a label and the coordinates as a position attribute for each Node. More...
 

Function Documentation

◆ generateEdges()

GIRGS_API std::vector<std::pair<int,int> > girgs::generateEdges ( const std::vector< double > &  weights,
const std::vector< std::vector< double >> &  positions,
double  alpha,
int  samplingSeed 
)

Samples edges according to weights and positions. An edge between node u and v is formed with probability \( \left(\frac{w_u w_v / W}{|| x_u - x_v ||^d}\right)^\alpha \) or 1.0 if the term exceeds 1.0.

Parameters
weightsPower law distributed weights.
positionsPositions on a torus. All inner vectors should have the same length indicating the dimension of the torus.
alphaEdge probability parameter.
samplingSeedSeed to sample the edges.
Returns
An edge list with zero based indices.

◆ generatePositions()

GIRGS_API std::vector<std::vector<double> > girgs::generatePositions ( int  n,
int  dimension,
int  positionSeed,
bool  parallel = true 
)

Samples d dimensional coordinates for n points on a torus \([0,1)^d\).

Parameters
nSize of the graph.
dimensionDimension of the geometry.
positionSeedSeed to sample the positions.
Returns
The positions on a torus. All inner vectors have the same length.

◆ generateWeights()

GIRGS_API std::vector<double> girgs::generateWeights ( int  n,
double  ple,
int  weightSeed,
bool  parallel = true 
)

The weights are sampled according to a power law distribution between [1, n)

Parameters
nThe size of the graph. Should match with size of positions.
pleThe power law exponent to sample the new weights. Should be 2.0 to 3.0.
weightSeedA seed for weight sampling. Should not be equal to the position seed.
Returns
The weights according to the desired distribution.

◆ saveDot()

GIRGS_API void girgs::saveDot ( const std::vector< double > &  weights,
const std::vector< std::vector< double >> &  positions,
const std::vector< std::pair< int, int >> &  graph,
const std::string &  file 
)

Saves the graph in .dot format (graphviz). The weight is saved as a label and the coordinates as a position attribute for each Node.

Parameters
weightsPower law distributed weights.
positionsThe positions on a torus.
graphAn edge list with zero based indices.
fileThe name of the output file.

◆ scaleWeights()

GIRGS_API double girgs::scaleWeights ( std::vector< double > &  weights,
double  desiredAvgDegree,
int  dimension,
double  alpha 
)

Scales all weights so that the expected average degree equals desiredAvgDegree. Implemented as binary search over an estimation function.

Bug:
For \(\alpha > 10\) we use the estimation for threshold graphs due to numerical difficulties. This leads to slightly higher degrees than desired. Also I experienced inaccurate results for \(9 \leq \alpha < 10\).
Parameters
weightsThe weights to be modified.
desiredAvgDegreeThe desired average degree.
dimensionDimension of the underlying geometry. Should equal the dimensionality of the positions.
alphaParameter of the algorithm. Should be the same as for the generation process.
Returns
The scaling s applied to all weights. The constant c hidden in the theta of the edge probabilities is \(s^\alpha\) for \(\alpha < \infty\) and \(s^{1/d}\) in the threshold case.