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

View source: R/getWeight.R

getWeightR Documentation

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, obj.types = NULL)

Arguments

graph

[grapherator]
Graph.

edgelist

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

obj.types

[character]
How to aggregate edge weights? Possible values are “sum” for sum objective and “bottleneck” for bottleneck/min-max objectives. Default is “sum” for each objective.

Value

[numeric(2)] Weight vector.

Examples

# 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))
getWeight(g, prueferToEdgeList(pcode), obj.types = "bottleneck")

mcMST documentation built on April 1, 2023, 12:19 a.m.