Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


mcMST (version 1.0.1)

getWeight: Get the overall costs/weight of a subgraph given its edgelist.

Description

Get the overall costs/weight of a subgraph given its edgelist.

Usage

getWeight(graph, edgelist)

Value

[numeric(2)] Weight vector.

Arguments

graph

[mcGP]
Multi-objective graph problem.

edgelist

[matrix(2, k)] Matrix of edges (each column is one edge).

Examples

Run this code
# generate a random bi-objective graph
g = genRandomMCGP(5)

# generate a random Pruefer code, i.e., a random spanning tree of g
pcode = sample(1:5, 3, replace = TRUE)

getWeight(g, prueferToEdgeList(pcode))

Run the code above in your browser using DataLab