weightGenerators: Weight generators.

Description Usage Arguments Value Note

Description

Function for adding weight(s) to edges. The following functions are implemented and may be passed as argument generator to addWeights:

addWeightsRandom

Add purely random weights. Calls the passed method, e.g., method = runif to generate weights.

addWeightsDistance

Weights correspond to a distance metric based on the node coordinates in the Euclidean plane. Internally function dist is called.

addWeightsCorrelated

This method generates two weight matrices with correlated weights. The correlation may be adjusted by the rho argument. Here, the first weight of an edge is the Euclidean distance between the nodes in the plane and the second one is generated in a way, that the correlation is close to rho.

addWeightsCocave

This method is interesting for generating bi-objective graphs to benchmark algorithms for the multi-criteria spanning tree problem. Graphs generated this way expose a concave Pareto-front.

Usage

1
2
3
4
5
6
7
addWeightsConcave(graph, xhi = 10, nu = 20, M = 100, ...)

addWeightsCorrelated(graph, rho, ...)

addWeightsDistance(graph, method, ...)

addWeightsRandom(graph, method, ...)

Arguments

graph

[grapherator]
Graph.

xhi

[integer(1)]
Positive integer for addWeightsConcave. Default is 10.

nu

[integer(1)]
Positive integer for addWeightsConcave. Default is 20.

M

[integer(1)]
Maximum weight for weights generated via addWeightsConcave. Note that M minus xhi needs to be much bigger than nu. Default is 100.

...

[any] Further arguments. Not used at the moment. This may be useful for user-written weight generators.

rho

[numeric(1)]
Desired correlation, i.e., value between -1 and 1, of edge weights for addWeightsCorrelated.

method

[character(1) | function(n, ...)]
String representing the distance measure to use for addWeightsDistance (see method argument of dist) or function(n, ...) used to generate random weights in case of addWeightsRandom.

Value

[list] A list with components

weights [list]

List of weight matrices. Even in the case of one weight matrix it is wrapped in a list of length one.

generator [character(1)]

String description of the generator used.

Note

These functions are not meant to be called directly. Instead, they need to be assigned to the generator argument of addWeights.


jakobbossek/grapherator documentation built on Feb. 23, 2018, 12:13 a.m.