Zog.Flow (Zog v0.1.0)

View Source

Native network flow and cut algorithms backed by Zog (Zig) via Zigler.

Summary

Functions

Computes the global minimum cut of an undirected weighted network using the Stoer-Wagner algorithm.

Computes the maximum flow and minimum cut from source to sink in the network using the native Zog backend.

Functions

edmonds_karp_f64(arg1, arg2, arg3, arg4, arg5, arg6)

@spec edmonds_karp_f64(
  0..18_446_744_073_709_551_615,
  [0..4_294_967_295] | <<_::_*32>>,
  [0..4_294_967_295] | <<_::_*32>>,
  [float()] | <<_::_*64>>,
  0..4_294_967_295,
  0..4_294_967_295
) :: %{
  max_flow: float(),
  residual_cap: [float()],
  residual_from: [0..4_294_967_295],
  residual_to: [0..4_294_967_295],
  sink_side: [0..4_294_967_295],
  source_side: [0..4_294_967_295]
}

global_min_cut(builder)

@spec global_min_cut(Zog.SoA.t()) :: %{
  cut_value: float(),
  source_side: [Zog.SoA.label()],
  sink_side: [Zog.SoA.label()]
}

Computes the global minimum cut of an undirected weighted network using the Stoer-Wagner algorithm.

global_min_cut_f64(arg1, arg2, arg3, arg4)

@spec global_min_cut_f64(
  0..18_446_744_073_709_551_615,
  [0..4_294_967_295] | <<_::_*32>>,
  [0..4_294_967_295] | <<_::_*32>>,
  [float()] | <<_::_*64>>
) :: %{
  cut_value: float(),
  sink_side: [0..4_294_967_295],
  source_side: [0..4_294_967_295]
}

max_flow(builder, source, sink, algorithm \\ :edmonds_karp)

@spec max_flow(Zog.SoA.t(), Zog.SoA.label(), Zog.SoA.label(), atom()) :: %{
  max_flow: float(),
  residual_graph: Zog.SoA.t(),
  source_side: [Zog.SoA.label()],
  sink_side: [Zog.SoA.label()]
}

Computes the maximum flow and minimum cut from source to sink in the network using the native Zog backend.

push_relabel_f64(arg1, arg2, arg3, arg4, arg5, arg6)

@spec push_relabel_f64(
  0..18_446_744_073_709_551_615,
  [0..4_294_967_295] | <<_::_*32>>,
  [0..4_294_967_295] | <<_::_*32>>,
  [float()] | <<_::_*64>>,
  0..4_294_967_295,
  0..4_294_967_295
) :: %{
  max_flow: float(),
  residual_cap: [float()],
  residual_from: [0..4_294_967_295],
  residual_to: [0..4_294_967_295],
  sink_side: [0..4_294_967_295],
  source_side: [0..4_294_967_295]
}