class AtCoder::MinCostFlow
- AtCoder::MinCostFlow
- Reference
- Object
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.crConstructors
-
.new(size : Int64)
Implements atcoder::mcf_graph g(n).
Instance Method Summary
-
#add_edge(from, to, capacity, cost)
Implements atcoder::mcf_graph.add_edge(from, to, capacity, cost).
-
#flow(start, target, flow_limit : Int | Nil = nil)
Implements atcoder::mcf_graph.flow(start, target, flow_limit).
- #size(*args, **options)
- #size(*args, **options, &)
-
#slope(start, target, flow_limit : Int | Nil = nil)
Implements atcoder::mcf_graph.slope(start, target, flow_limit).
Constructor Detail
Instance Method Detail
def add_edge(from, to, capacity, cost)
#
Implements atcoder::mcf_graph.add_edge(from, to, capacity, cost).
Implements atcoder::mcf_graph.flow(start, target, flow_limit).
Implements atcoder::mcf_graph.slope(start, target, flow_limit). ameba:disable Metrics/CyclomaticComplexity