109 template <AlephGraph
GT,
116 <<
"edge_connectivity() does not work on digraphs";
123 long min_degree = std::numeric_limits<long>::max();
126 auto p = it.get_curr();
131 if (degree < min_degree)
154 auto p = it.get_curr();
163 auto a = it.get_curr();
170 long min_k = min_degree;
177 auto node = it.get_curr();
185 const auto sink = it.get_curr();
209 template <AlephGraph
GT,
262 template <AlephGraph
GT,
276 <<
"compute_min_cut() does not work on digraphs";
283 long min_degree = std::numeric_limits<long>::max();
286 auto p = it.get_curr();
291 if (degree < min_degree)
303 auto p = it.get_curr();
319 auto p = it.get_curr();
327 auto arc = it.get_curr();
343 auto p = it.get_curr();
354 auto a = it.get_curr();
368 long min_k = std::numeric_limits<long>::max();
374 if (
auto node = it.get_curr(); node != source)
380 auto sink = it.get_curr();
396 it.has_curr(); it.next_ne())
397 if (
auto node = it.get_curr();
net_node_map.contains(node))
401 it.has_curr(); it.next_ne())
402 if (
auto node = it.get_curr();
net_node_map.contains(node))
407 if (
auto arc = it.get_curr();
net_arc_map.contains(arc))
412 if (
auto arc = it.get_curr();
net_arc_map.contains(arc))
428 it.has_curr(); it.next_ne())
432 it.has_curr(); it.next_ne())
438 typename Net::Arc *arc = it.get_curr();
453 template <AlephGraph
GT,
496 template <AlephGraph
GT,
503 <<
"vertex_connectivity() does not work on digraphs";
510 long min_degree = std::numeric_limits<long>::max();
513 auto p = it.get_curr();
518 if (degree < min_degree)
540 auto p = it.get_curr();
546 auto a = it.get_curr();
553 long min_k = min_degree;
557 auto source =
k.get_curr();
570 auto sink = j.get_curr();
590 auto p = it.get_curr();
591 if (p == source
or p == sink)
604 auto a = it.get_curr();
#define ah_domain_error_if(C)
Throws std::domain_error if condition holds.
C++20 concepts for the protocol shared by graph algorithms.
List_Graph< Graph_Node< Node_Info >, Graph_Arc< Arc_Info > > GT
Functor wrapper for compute_min_cut().
long operator()(GT &g, DynSetTree< typename GT::Node * > &l, DynSetTree< typename GT::Node * > &r, DynDlist< typename GT::Arc * > &cut)
Compute a minimum edge cut for g.
RAII guard that clears graph cookies on destruction.
Stateful depth-first traversal functor.
bool has_curr() const noexcept
Return true the iterator has an current arc.
bool has_curr() const noexcept
Return true if the iterator has current item.
Dynamic doubly linked list with O(1) size and bidirectional access.
void empty() noexcept
@brief Empties the container.
T & append(const T &item)
Append a copied item at the end of the list.
Iterator on the items of list.
Doubly-linked list (defined in tpl_dynList.H).
T & insert(const T &item)
void empty() noexcept
empty the list
Dynamic map implemented with a treap.
Pair * insert(const Key &key, const Data &data)
Insert a key-value pair.
Data & find(const Key &key)
Find the value associated with key.
Dynamic set backed by balanced binary search trees with automatic memory management.
Functor wrapper for edge_connectivity().
long operator()(GT &g)
Compute edge connectivity of g.
void next()
Advances the iterator to the next filtered element.
void next_ne() noexcept
Advances the iterator to the next filtered element (noexcept version).
bool has_curr() const noexcept
Filtered iterator on the nodes of a graph.
Node * get_src_node(Arc *arc) const noexcept
Return the source node of arc (only for directed graphs)
constexpr size_t get_num_nodes() const noexcept
Return the total of nodes of graph.
bool is_digraph() const noexcept
Return true if the graph this is directed.
Node * get_connected_node(Arc *arc, Node *node) const noexcept
Return the adjacent node to node through arc.
Node * get_tgt_node(Arc *arc) const noexcept
Return the target node of arc (only for directed graphs)
static void map_nodes(N1 *p, N2 *q) noexcept
Map the nodes through their cookies.
RAII guards for graph node/arc cookies.
long edge_connectivity(GT &g)
Compute edge connectivity (arc connectivity) of an undirected graph.
#define ARC_COOKIE(p)
Return the arc cookie
long compute_min_cut(GT &g, DynSetTree< typename GT::Node * > &l, DynSetTree< typename GT::Node * > &r, DynDlist< typename GT::Arc * > &cut)
Compute a minimum edge cut of an undirected graph.
#define IS_NODE_VISITED(p, bit)
Determine whether the control bit is set or not to one.
#define NODE_COOKIE(p)
Return the node cookie
long vertex_connectivity(GT &g)
Compute vertex connectivity of an undirected graph.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
Net_Graph< Net_Node< string >, Net_Arc< Empty_Class, FlowType > > Net
Main namespace for Aleph-w library functions.
and
Check uniqueness with explicit hash + equality functors.
Filtered iterator on all the arcs of a graph.
Default filter for filtered iterators on arcs.
Functor wrapper for heap_preflow_maximum_flow().
Arc of a flow network implemented with adjacency lists.
Flow network implemented with adjacency lists.
Node * insert_node(const Node_Type &node_info)
Insert a new node by copying node_info.
Arc * connect_arc(Arc *arc)
Connect a previously disconnected arc.
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.
typename Arc::Flow_Type Flow_Type
Capacity/flow numeric type.
void remove_node(Node *p) noexcept override
Remove node p and all its arcs from the network.
void reset()
Reset all arc flows to zero.
Filtered iterator of adjacent arcs of a node.
Functor wrapper for random_preflow_maximum_flow().
Dynamic set implementations based on balanced binary search trees.
Network flow graph structures.