Function for adding weight(s) to edges. The following functions
are implemented and may be passed as argument generator to addWeights:
addWeightsRandomAdd purely random weights. Calls the passed method, e.g., method = runif to generate weights.
addWeightsDistanceWeights correspond to a distance metric based on the node coordinates
in the Euclidean plane. Internally function dist is called.
addWeightsCorrelatedThis 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.
addWeightsCocaveThis 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.
addWeightsConcave(graph, xhi = 10, nu = 20, M = 100, ...)addWeightsCorrelated(graph, rho, ...)
addWeightsDistance(graph, method, ...)
addWeightsRandom(graph, method, ...)
[grapherator]
Graph.
[integer(1)]
Positive integer for addWeightsConcave.
Default is 10.
[integer(1)]
Positive integer for addWeightsConcave.
Default is 20.
[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.
[numeric(1)]
Desired correlation, i.e., value between -1 and 1, of edge weights for
addWeightsCorrelated.
[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.
[list] A list with components
list]List of weight matrices. Even in the case of one weight matrix it is wrapped in a list of length one.
character(1)]String description of the generator used.