Trait MaxFlow

Source
pub trait MaxFlow {
    type Cap;

    // Required methods
    fn new(n: usize) -> Self;
    fn add_edge(&mut self, u: usize, v: usize, cap: Self::Cap);
    fn max_flow(&mut self, s: usize, t: usize) -> Self::Cap;
    fn get_edges(&self, i: usize) -> Vec<(usize, Self::Cap)>;
    fn reset(&mut self);
}
Expand description

最大フロー問題を扱うトレイト。

Required Associated Types§

Source

type Cap

容量の型

Required Methods§

Source

fn new(n: usize) -> Self

頂点数nの空のグラフを返す。

Source

fn add_edge(&mut self, u: usize, v: usize, cap: Self::Cap)

頂点uから頂点vへ容量capの辺を張る。

Source

fn max_flow(&mut self, s: usize, t: usize) -> Self::Cap

頂点sから頂点tへの最大フローを求める。

Source

fn get_edges(&self, i: usize) -> Vec<(usize, Self::Cap)>

最大フローを達成するのに通った辺を返す。

Source

fn reset(&mut self)

フローを初期化する。

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§