class AtCoder::MinCostFlow

Overview

Implements atcoder::mcf_graph.

flow = AtCoder::MinCostFlow.new(5)
flow.add_edge(0, 1, 30, 3)
flow.add_edge(0, 2, 60, 9)
flow.add_edge(1, 2, 40, 5)
flow.add_edge(1, 3, 50, 7)
flow.add_edge(2, 3, 20, 8)
flow.add_edge(2, 4, 50, 6)
flow.add_edge(3, 4, 60, 7)
flow.flow(0, 4, 70) # => {70, 1080}

Defined in:

min_cost_flow.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(size : Int64) #

Implements atcoder::mcf_graph g(n).


[View source]

Instance Method Detail

def add_edge(from, to, capacity, cost) #

Implements atcoder::mcf_graph.add_edge(from, to, capacity, cost).


[View source]
def flow(start, target, flow_limit : Int | Nil = nil) #

Implements atcoder::mcf_graph.flow(start, target, flow_limit).


[View source]
def size(*args, **options) #

[View source]
def size(*args, **options, &) #

[View source]
def slope(start, target, flow_limit : Int | Nil = nil) #

Implements atcoder::mcf_graph.slope(start, target, flow_limit). ameba:disable Metrics/CyclomaticComplexity


[View source]