79 for (
int i = 0; i < weights.
size(); i++) {
81 nodeWeights[nodes[i]] = weights[i];
82 for (
int j = 0; j < dimension; j++){
83 cord[nodes[i]][j] = dist(rng);
87 for (
node v : nodes) {
89 double distance = 0.0;
90 for (
int i = 0; i < dimension; i++) {
91 distance += (cord[v][i] - cord[w][i]) * (cord[v][i] - cord[w][i]);
93 distance = sqrt(distance);
95 if ((nodeWeights[v] + nodeWeights[w]) * h(distance) > threshold) {
122 randomGeographicalThresholdGraph<D>(G, weights, dist, threshold, [alpha](
double d){
return 1/pow(d, alpha); }, dimension);
virtual void clear()
Removes all nodes and all edges from the graph.
Data type for general directed graphs (adjacency list representation).
node succ() const
Returns the successor in the list of all nodes.
long unsigned int randomSeed()
Returns a random value suitable as initial seed for a random number engine.
void randomGeographicalThresholdGraph(Graph &G, Array< int > &weights, D &dist, double threshold, std::function< double(double)> h, int dimension=2)
Creates a random geometric graph where edges are created based on their distance and the weight of no...
INDEX size() const
Returns the size (number of elements) of the array.
edge newEdge(node v, node w)
Creates a new edge (v,w) and returns it.
Class for the representation of nodes.
Includes declaration of graph class.
The namespace for all OGDF objects.
node newNode()
Creates a new node and returns it.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.