38#include <gtest/gtest.h>
167 if (it.get_tgt_node_ne() == super_source)
202 if (it.get_tgt_node_ne() == super_sink)
301 auto &
rnet = std::get<0>(residual);
305 for (
typename Rnet::Arc_Iterator it(
rnet); it.has_curr(); it.next_ne())
307 auto arc = it.get_curr();
308 if (arc->img !=
nullptr)
size_t size_t int32_t value
Generic directed graph (digraph) wrapper template.
Iterator on the items of list.
Doubly-linked list (defined in tpl_dynList.H).
Dynamic set backed by balanced binary search trees with automatic memory management.
const size_t & size() const
Returns the cardinality of the set.
bool contains(const Key &key) const
Checks if a key exists in the set.
void next_ne() noexcept
Advances the iterator to the next filtered element (noexcept version).
Augmenting-path search over a directed network.
bool has_curr() const noexcept
constexpr bool is_empty() const noexcept
constexpr size_t get_num_nodes() const noexcept
Return the total of nodes of graph.
constexpr size_t get_num_arcs() const noexcept
DynArray< Graph::Node * > nodes
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
Main namespace for Aleph-w library functions.
Net::Flow_Type edmonds_karp_maximum_flow(Net &net)
Maximize flow using the Edmonds-Karp algorithm.
Net::Flow_Type random_preflow_maximum_flow(Net &net)
Preflow-push maximum flow using a random active-node queue.
Path< Net > find_aumenting_path_dfs(const Net &net, const typename Net::Flow_Type &min_slack)
Find an augmenting path using DFS.
Net::Flow_Type heap_preflow_maximum_flow(Net &net)
Preflow-push maximum flow using a height-ordered heap.
Net::Flow_Type increase_flow(Net &net, const Path< Net > &path)
Increase flow along an augmenting path.
std::tuple< PP_Res_Net< Net >, typename PP_Res_Net< Net >::Node *, typename PP_Res_Net< Net >::Node * > preflow_create_residual_net(Net &net)
Build the residual network for preflow-push algorithms.
Net::Flow_Type fifo_preflow_maximum_flow(Net &net)
Preflow-push maximum flow using a FIFO queue of active nodes.
Net::Flow_Type ford_fulkerson_maximum_flow(Net &net)
Maximize flow using the Ford-Fulkerson algorithm.
void update_flow(const Rnet &rnet)
Propagate residual arc flows back to their original arcs.
Net_Sup_Dem_Graph< SimpleNode, SimpleArc > SimpleNet
Arc of a flow network implemented with adjacency lists.
Arc filter for residual traversal in flow networks.
Flow network implemented with adjacency lists.
void unmake_super_source() noexcept
Restore a super-source network to its original multi-source form.
Node * insert_node(const Node_Type &node_info)
Insert a new node by copying node_info.
const DynSetTree< Node * > & get_sink_nodes() const noexcept
Return the set of sink nodes.
const DynSetTree< Node * > & get_src_nodes() const noexcept
Return the set of source nodes.
Arc * connect_arc(Arc *arc)
Connect a previously disconnected arc.
void unmake_super_sink() noexcept
Restore a super-sink network to its original multi-sink form.
void remove_arc(Arc *arc) override
Remove arc arc from the network.
void make_super_source()
Convert a multi-source network into a single super-source network.
void make_super_sink()
Convert a multi-sink network into a single super-sink network.
size_t get_out_degree(Node *p) const noexcept
Return the out-degree of p (number of outgoing arcs).
bool is_source(Node *node) const noexcept
Return true if node is a source.
Node * get_source() const
Return an arbitrary source node.
Arc * insert_arc(Node *src_node, Node *tgt_node, const Flow_Type &cap, const Flow_Type &flow, const typename Arc::Arc_Type &arc_info=Arc_Type())
Insert a capacitated arc with an initial flow.
void disconnect_arc(Arc *arc) noexcept
Disconnect arc arc from the graph without deleting it.
Node * get_sink() const
Return an arbitrary sink node.
bool is_sink(Node *node) const noexcept
Return true if node is a sink.
size_t get_in_degree(Node *p) const noexcept
Return the in-degree of p (number of incoming arcs).
Filtered iterator of adjacent arcs of a node.
Network flow graph structures.