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.
addWeights(graph, method = "euclidean", weights = NULL, weight.fun = NULL,
n = NULL, symmetric = TRUE, ...)
[mcGP
] Multi-objective graph problem.
[mcGP
]
Multi-objective graph problem.
[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.
[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
.
[function(m, ...) | NULL
]
Function used to generate weights. The first arument needs to be number of weights
to generate.
[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
.
[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.
Other graph generators: addCenters
,
addCoordinates
, mcGP