# Crate mcmf[−][src]

This crate is for solving instances of the minimum cost maximum flow problem. It uses the network simplex algorithm from the LEMON graph optimization library.

# Example

```use mcmf::{GraphBuilder, Vertex, Cost, Capacity};
let (cost, paths) = GraphBuilder::new()
.mcmf();
assert_eq!(cost, 650);
assert_eq!(cost, paths.iter().map(|path| path.cost()).sum());
assert_eq!(paths.len(), 2);
assert!(
paths[0].vertices() == vec![
&Vertex::Source,
&Vertex::Node("Vancouver"),
&Vertex::Node("Halifax"),
&Vertex::Sink]);
assert!(
paths[1].vertices() == vec![
&Vertex::Source,
&Vertex::Node("Vancouver"),
&Vertex::Node("Toronto"),
&Vertex::Node("Halifax"),
&Vertex::Sink]);```

## Structs

 Capacity Wrapper type representing the capacity of an edge in the graph. Cost Wrapper type representing the cost of an edge in the graph. Flow Represents flow in a solution to the minimum cost maximum flow problem. GraphBuilder Use this struct to build a graph, then call the `mcmf()` function to find its minimum cost maximum flow. Path Represents a path from the source to the sink in a solution to the minimum cost maximum flow problem.

## Enums

 Vertex This class represents a vertex in a graph. It is parametrized by `T` so that users of the library can use the most convenient type for representing nodes in the graph.