|
Open Graph Drawing Framework |
v. 2023.09 (Elderberry)
|
|
|
Go to the documentation of this file.
74 std::function<
double(
double)> h,
int dimension = 2) {
85 for (
int i = 0; i < weights.
size(); i++) {
86 nodes[i] = G.newNode();
87 nodeWeights[nodes[i]] = weights[i];
88 for (
int j = 0; j < dimension; j++) {
89 cord[nodes[i]][j] = dist(rng);
93 for (
node v : nodes) {
95 double distance = 0.0;
96 for (
int i = 0; i < dimension; i++) {
97 distance += (cord[v][i] - cord[w][i]) * (cord[v][i] - cord[w][i]);
99 distance = sqrt(distance);
101 if ((nodeWeights[v] + nodeWeights[w]) * h(distance) > threshold) {
127 int alpha = 2,
int dimension = 2) {
128 randomGeographicalThresholdGraph<D>(
129 G, weights, dist, threshold, [alpha](
double d) {
return 1 / pow(d, alpha); }, dimension);
The namespace for all OGDF objects.
Includes declaration of graph class.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
RegisteredArray for nodes, edges and adjEntries of a graph.
Data type for general directed graphs (adjacency list representation).
long unsigned int randomSeed()
Returns a random value suitable as initial seed for a random number engine.
Basic declarations, included by all source files.
node succ() const
Returns the successor in the list of all nodes.
Declaration and implementation of Array class and Array algorithms.
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.
Class for the representation of nodes.