documentationfor yFiles for HTML 2.6

MinimumCostFlow

Solves a minimum-cost flow problem.

Inheritance Hierarchy
MinimumCostFlow

Remarks

The minimum-cost flow problem is an optimization problem to find the cheapest possible way of sending a certain amount of flow through a network with capacities and costs.

There are three main ways of using this class, depending on how the problem to solve is stated. All variants require the maximumCapacities and costs.

  1. There can be minimumCapacities for edges as well as the maximumCapacities. In this variant supply is considered for defining supply/demand for nodes in the network, while source and sink are ignored.
  2. A source and sink node can be provided, in which case supply is ignored.
  3. As a third option, multiple nodes can have specific values for supply and demand configured via supply.

Other Flow Algorithms

yFiles for HTML supports another algorithm related to network flow:

  • MaximumFlow – solves a maximum flow problem where the largest possible flow through a network should be determined

Examples

Calculating a minimum cost flow of the graph
// prepare the minimum cost flow algorithm
const algorithm = new MinimumCostFlow({
  maximumCapacities,
  supply,
  costs
})
// run the algorithm
const result = algorithm.run(graph)

// add labels indicating the actual flow
for (const edge of graph.edges) {
  graph.addLabel(edge, String(result.flow.get(edge)))
}

Type Details

yfiles module
view-layout-bridge
yfiles-umd modules
view-layout-bridge
Legacy UMD name
yfiles.analysis.MinimumCostFlow

See Also

Constructors

Properties

Methods