Learn R Programming

mcMST (version 1.0.1)

addWeights: Add weights to a multi-objective graph.

Description

addWeights allows to generate edge weights for a multi-objective graph instance. The weights can be generated on basis of the node coordinates (in this case dist is applied with the cooresponding method). Alternatively, all kinds of random weights can be generated.

Usage

addWeights(graph, method = "euclidean", weights = NULL, weight.fun = NULL,
  n = NULL, symmetric = TRUE, ...)

Value

[mcGP] Multi-objective graph problem.

Arguments

graph

[mcGP]
Multi-objective graph problem.

method

[character(1)]
Method used to generate weights. Possible values are “euclidean”, “maximum”, “manhatten”, “canberra”, “binary”, minkowski or random. The latter generates (random) weights utilizing weight.fun. The remaining options are passed down to dist, i.e., weights are generated as distances between the node coordinates.

weights

[matrix]
Square matrix of weights. If some weights are already assigned, pay attention to the correct dimensions. If this is passed all other arguments are ignored. Default is NULL.

weight.fun

[function(m, ...) | NULL]
Function used to generate weights. The first arument needs to be number of weights to generate.

n

[integer(1)]
Number of nodes. This is required only if there are no coordinates or no weights until now. Default is NULL, i.e., the number of nodes is extracted from graph.

symmetric

[logical(1)]
Should the weights be symmetric, i.e., w(i, j) = w(j, i) for each pair i, j of nodes? Default is TRUE.

...

[any]
Additional arguments passed down to weight.fun or dist. See documentation of argument method for details.

See Also

Other graph generators: addCenters, addCoordinates, mcGP