nxpp
Header-only graph utilities on top of Boost Graph Library
Loading...
Searching...
No Matches
nxpp::MinCostMaxFlowResult< NodeID > Struct Template Reference

Result of a min-cost max-flow computation. More...

#include <flow.hpp>

Collaboration diagram for nxpp::MinCostMaxFlowResult< NodeID >:

Public Attributes

long flow = 0
 
long cost = 0
 
std::map< std::pair< NodeID, NodeID >, long > edge_flows
 
std::map< std::size_t, long > edge_flows_by_id
 

Detailed Description

template<typename NodeID>
struct nxpp::MinCostMaxFlowResult< NodeID >

Result of a min-cost max-flow computation.

The total pushed flow and total cost are reported alongside both an endpoint-keyed convenience view and a precise edge-ID keyed flow view. In multigraphs, prefer edge_flows_by_id whenever one concrete parallel edge matters.

Example:

g.add_edge("s", "a", 2.0, {{"capacity", 3L}});
g.add_edge("a", "t", 1.0, {{"capacity", 3L}});
auto result = g.max_flow_min_cost("s", "t");
auto total_flow = result.flow;
auto total_cost = result.cost;
Graph wrapper around Boost Graph Library with Python-inspired helpers.
Definition graph.hpp:272
auto max_flow_min_cost(const NodeID &source_id, const NodeID &target_id, const std::string &capacity_attr="capacity", const std::string &weight_attr="weight") const
Convenience alias for the default max-flow min-cost wrapper.
Definition flow.hpp:732

The documentation for this struct was generated from the following file: