|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Flow network implemented with adjacency lists. More...
#include <tpl_net.H>
Public Types | |
| using | Net = Net_Graph< NodeT, ArcT > |
| using | Base = Array_Graph< NodeT, ArcT > |
| using | Graph = Base |
| using | Arc = ArcT |
| Arc type. | |
| using | Node = NodeT |
| Node type. | |
| using | Flow_Type = typename Arc::Flow_Type |
| Capacity/flow numeric type. | |
| using | Node_Type = typename Node::Node_Type |
| Node info type. | |
| using | Arc_Type = typename Arc::Arc_Type |
| Arc info type. | |
Public Types inherited from Aleph::Array_Graph< __Graph_Node, __Graph_Arc > | |
| using | Node = __Graph_Node |
| using | Arc = __Graph_Arc |
| using | Node_Type = typename Node::Node_Type |
| using | Arc_Type = typename Arc::Arc_Type |
| using | CommonBase = GraphCommon< Array_Graph< __Graph_Node, __Graph_Arc >, __Graph_Node, __Graph_Arc > |
Public Types inherited from GraphCommon< GT, Node, Arc > | |
| using | Node_Type = typename Node::Node_Type |
| using | Arc_Type = typename Arc::Arc_Type |
| using | ArcPair = std::tuple< Arc *, Node * > |
| Pair of arc and node (topologically related) | |
Public Member Functions | |
| DynList< Arc * > | out_arcs (Node *p) const noexcept |
Return arcs outgoing from p (as a DynList). | |
| DynList< Node * > | out_nodes (Node *p) const noexcept |
Return nodes reachable from p through outgoing arcs. | |
| DynList< Arc * > | in_arcs (Node *p) const noexcept |
Return arcs incoming to p (as a DynList). | |
| DynList< Node * > | in_nodes (Node *p) const noexcept |
Return nodes that can reach p through incoming arcs. | |
| Flow_Type | get_in_cap (Node *node) const noexcept |
Return total incoming capacity of node. | |
| Flow_Type | get_out_cap (Node *node) const noexcept |
Return total outgoing capacity of node. | |
| size_t | get_in_degree (Node *p) const noexcept |
Return the in-degree of p (number of incoming arcs). | |
| size_t | get_out_degree (Node *p) const noexcept |
Return the out-degree of p (number of outgoing arcs). | |
| Flow_Type | get_out_flow (Node *node) const noexcept |
Return total outgoing flow of node. | |
| Flow_Type | get_in_flow (Node *node) const noexcept |
Return total incoming flow of node. | |
| bool | is_source (Node *node) const noexcept |
Return true if node is a source. | |
| bool | is_sink (Node *node) const noexcept |
Return true if node is a sink. | |
| constexpr bool | is_single_source () const noexcept |
| Return true if the network has a single source. | |
| constexpr bool | is_single_sink () const noexcept |
| Return true if the network has a single sink. | |
| bool | is_connected (Node *p) const noexcept |
Return true if p is connected (used for validation). | |
| bool | check_node (Node *node) const noexcept |
Return true if node satisfies flow conservation constraints. | |
| const DynSetTree< Node * > & | get_src_nodes () const noexcept |
| Return the set of source nodes. | |
| const DynSetTree< Node * > & | get_sink_nodes () const noexcept |
| Return the set of sink nodes. | |
| void | make_super_source () |
| Convert a multi-source network into a single super-source network. | |
| void | unmake_super_source () |
| Restore a super-source network to its original multi-source form, by removing the super source that make_super_source() inserted. | |
| void | make_super_sink () |
| Convert a multi-sink network into a single super-sink network. | |
| void | unmake_super_sink () |
| Restore a super-sink network to its original multi-sink form, by removing the super sink that make_super_sink() inserted. | |
| void | make_super_nodes () |
| Convert a multi-source/multi-sink network into super-source/super-sink. | |
| void | unmake_super_nodes () |
| Restore a super-source/super-sink network to its original form. | |
| Node * | get_source () const |
| Return an arbitrary source node. | |
| Node * | get_sink () const |
| Return an arbitrary sink node. | |
| Node * | insert_node (const Node_Type &node_info) |
Insert a new node by copying node_info. | |
| Node * | insert_node () |
| Insert a new node with default info. | |
| Node * | insert_node (Node_Type &&info) |
Insert a new node by moving info. | |
| template<typename... Args> | |
| Node * | emplace_node (Args &&...args) |
| Construct a node in-place and insert it into the network. | |
| Node * | insert_node (Node *p) override |
Insert the node p, allocated by the caller. | |
| 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. | |
| template<typename... Args> | |
| Arc * | emplace_arc (Node *src_node, Node *tgt_node, const Flow_Type &cap, const Flow_Type &flow, Args &&...args) |
| Construct arc info in-place and insert the arc. | |
| Arc * | connect_arc (Arc *arc) |
| Connect a previously disconnected arc. | |
| Arc * | insert_arc (Node *src_node, Node *tgt_node, const Flow_Type &cap) |
Insert an arc with capacity cap and zero flow. | |
| Arc * | insert_arc (Node *src_node, Node *tgt_node, const Arc_Type &arc_info=Arc_Type()) |
| Insert an arc with zero capacity and flow. | |
| Arc * | insert_arc (Node *src_node, Node *tgt_node) |
| Insert an arc with zero capacity and flow, for an arc info that is arithmetic or of the type of the flow. | |
| void | remove_arc (Arc *arc) override |
Remove arc arc from the network. | |
| virtual void | disconnect_arc (Arc *arc) |
Disconnect arc arc from the graph without deleting it. | |
| void | remove_node (Node *p) override |
Remove node p and all its arcs from the network. | |
| Net_Graph (const Net_Graph &net) | |
| Copy-construct a network. Throws bad_alloc on allocation failure. | |
| void | swap (Net_Graph &other) noexcept |
| Swap contents with another network. | |
| Net_Graph (Net_Graph &&other) noexcept | |
| Move-construct a network. O(1) operation. | |
| Net_Graph & | operator= (Net_Graph &&other) noexcept |
| Move-assign a network. O(1) operation. | |
| Net_Graph & | operator= (const Net_Graph &net) |
| Copy-assign a network. Throws bad_alloc on allocation failure. | |
| void | set_cap (Arc *arc, const Flow_Type &cap) |
| Set the capacity of an arc. | |
| void | set_flow (Arc *arc, const Flow_Type &flow) |
Set the flow of an arc. Throws if flow exceeds capacity. | |
| const Flow_Type & | get_flow (Arc *arc) const noexcept |
| Return the flow value of an arc. | |
| const Flow_Type & | get_cap (Arc *arc) const noexcept |
| Return the capacity value of an arc. | |
| void | reset () |
| Reset all arc flows to zero. | |
| bool | check_network () const |
| Validate flow-conservation and capacity constraints. | |
| Flow_Type | flow_value () const |
| Return the total flow value of the network: the flow out of its sources, which a valid flow also takes into its sinks, as check_network() takes them. | |
| Net_Graph () | |
| Default constructor. | |
| virtual Node * | insert_node (Node *p) |
| Inserts the node p, made with new, which the graph takes. | |
| Node * | insert_node (const Node_Type &node_info) |
| Allocate a new node, set by copy its data content and insert it into the graph. | |
| Node * | insert_node (Node_Type &&node_info=Node_Type()) |
| Allocate a new node, set by moving its data content and insert it into the graph. | |
Public Member Functions inherited from Aleph::Array_Graph< __Graph_Node, __Graph_Arc > | |
| Dlink & | get_node_dlink () noexcept |
| Returns reference to internal node Dlink for sorting operations. | |
| Dlink & | get_arc_dlink () noexcept |
| Returns reference to internal arc Dlink for sorting operations. | |
| virtual Node * | insert_node (Node *p) |
| Inserts the node p, made with new, which the graph takes. | |
| void | compress () |
| Arc * | connect_arc (Arc *arc) |
| Arc * | disconnect_arc (Arc *arc) |
| virtual void | remove_arc (Arc *a) |
| virtual void | remove_node (Node *p) |
| Node * | get_first_node () const |
| Arc * | get_first_arc () const |
| Arc * | get_first_arc (Node *p) const |
| Array_Graph () | |
| virtual | ~Array_Graph () noexcept |
| void | swap (Array_Graph &g) noexcept |
| Array_Graph (const Array_Graph &g) | |
| Copy constructor. | |
| Array_Graph (Array_Graph &&g) noexcept | |
| Move constructor. | |
| Array_Graph & | operator= (const Array_Graph &g) |
| Copy assignment. | |
| Array_Graph & | operator= (Array_Graph &&g) noexcept |
| Move assignment. | |
| Node * | insert_node (const Node_Type &node_info) |
| Allocate a new node, set by copy its data content and insert it into the graph. | |
| Node * | insert_node (Node_Type &&node_info=Node_Type()) |
| Allocate a new node, set by moving its data content and insert it into the graph. | |
| Arc * | insert_arc (Node *src, Node *tgt, const Arc_Type &arc_info) |
| Create and insert a new arc linking two nodes and copying data. | |
| Arc * | insert_arc (Node *src, Node *tgt, Arc_Type &&arc_info=Arc_Type()) |
| Create and insert a new arc linking two nodes and moving the received data. | |
Public Member Functions inherited from GraphCommon< GT, Node, Arc > | |
| void *& | get_cookie () noexcept |
| Return a modifiable reference to graph's cookie. | |
| void * | get_cookie () const noexcept |
| Return a constant reference to graph's cookie. | |
| bool | is_digraph () const noexcept |
Return true if the graph this is directed. | |
| void | set_digraph (bool val) |
| Temporal indication for preventing to other algorithms that an graph must be treated as a directed graph. | |
| constexpr size_t | get_num_nodes () const noexcept |
| Return the total of nodes of graph. | |
| constexpr bool | is_empty () const noexcept |
| Checks if the graph is empty (has no nodes). | |
| constexpr size_t | vsize () const noexcept |
See get_num_nodes(). | |
| Node * | get_node () const |
| Return any node in the graph. | |
| Arc * | get_arc () const |
| Return any arc in the graph. | |
| Arc * | get_arc (Node *p) const |
| Return any arc adjacent to a node. | |
| Node * | get_src_node (Arc *arc) const noexcept |
Return the source node of arc (only for directed graphs) | |
| Node * | get_tgt_node (Arc *arc) const noexcept |
Return the target node of arc (only for directed graphs) | |
| Node * | get_connected_node (Arc *arc, Node *node) const noexcept |
Return the adjacent node to node through arc. | |
| constexpr size_t | get_num_arcs () const noexcept |
| Return the number of arcs of the graph. | |
| size_t | get_num_arcs (Node *node) const noexcept |
| Return the total of arcs of a node. | |
| size_t | degree (Node *p) const noexcept |
| Return the total of arcs (or degree) of a node. | |
| size_t | esize () const noexcept |
| Return the total of arcs of graph. | |
| Bit_Fields & | get_control_bits (Node *node) const noexcept |
Return a reference to control fields of node | |
| void | reset_bit (Node *node, int bit) const noexcept |
Reset the bit of node (to zero) | |
| void | reset_bits (Node *node) const noexcept |
Reset all the control bits of node | |
| int | get_bit (Node *node, int bit) const noexcept |
Get the control bit of node | |
| void | set_bit (Node *node, int bit, int value) const noexcept |
Set the control bit of node to value | |
| Bit_Fields & | get_control_bits (Arc *arc) const noexcept |
Return a reference to the control bits of arc | |
| void | reset_bit (Arc *arc, int bit) const noexcept |
Reset the bit of arc to zero. | |
| void | reset_bits (Arc *arc) const noexcept |
Reset all the control bits of arc | |
| int | get_bit (Arc *arc, int bit) const noexcept |
Get the control bit of arc | |
| void | set_bit (Arc *arc, int bit, int value) const noexcept |
Set the control bit of arc to value | |
| void *& | get_cookie (Node *node) const noexcept |
Get a modifiable reference to the cookie pointer of node | |
| void *& | get_cookie (Arc *arc) const noexcept |
Get a modifiable reference to the cookie pointer of arc | |
| long & | get_counter (Node *node) const noexcept |
Get a modifiable reference to the counter of node | |
| void | reset_counter (Node *node) const noexcept |
Reset the node counter to zero. | |
| void | reset_node_counters () const noexcept |
| Reset all the node counters of graph to zero. | |
| void | reset_node (Node *p) const noexcept |
Reset all the control attributes of node p. | |
| long & | get_counter (Arc *arc) const noexcept |
Get a modifiable reference to the counter of arc | |
| void | reset_counter (Arc *arc) const noexcept |
Reset the acr counter to zero. | |
| void | reset_arc_counters () const noexcept |
| Reset all the arc counters of graph to zero. | |
| void | reset_arc (Arc *arc) const noexcept |
Reset all the control attributes of arc. | |
| void | reset_nodes () const |
| Reset all the nodes of graph (the control bits, the state, the counter and the cookie) | |
| void | reset_arcs () const |
| Reset all the arcs of graph (the control bits, the state, the counter and the cookie) | |
| void | reset_bit_nodes (int bit) const noexcept |
Reset bit to zero for all the nodes of graph. | |
| void | reset_bit_arcs (int bit) const noexcept |
Reset bit to zero for all the arcs of graph. | |
| void | reset_bit_nodes () const noexcept |
| Reset all the bits for all the nodes of graph. | |
| void | reset_bit_arcs () const noexcept |
| Reset all the bits for all the arcs of graph. | |
| void | reset_counter_nodes () const noexcept |
| Reset all the counters to zero for all the nodes of graph. | |
| void | reset_counter_arcs () const noexcept |
| Reset all the counters to zero for all the arcs of graph. | |
| void | reset_cookie_nodes () const noexcept |
| Reset all the cookies to `nullptr for all the nodes of graph. | |
| void | reset_cookie_arcs () const noexcept |
| Reset all the cookies to `nullptr for all the arcs of graph. | |
| Node * | insert_node (const Node_Type &node_info) |
| Allocate a new node, set by copy its data content and insert it into the graph. | |
| Node * | insert_node (Node_Type &&node_info=Node_Type()) |
| Allocate a new node, set by moving its data content and insert it into the graph. | |
| template<typename... Args> | |
| Node * | emplace_node (Args &&... args) |
| Insert a new node in the graph by constructing it in-place with the given args. | |
| Arc * | insert_arc (Node *src, Node *tgt, const Arc_Type &arc_info) |
| Create and insert a new arc linking two nodes and copying data. | |
| Arc * | insert_arc (Node *src, Node *tgt, Arc_Type &&arc_info=Arc_Type()) |
| Create and insert a new arc linking two nodes and moving the received data. | |
| template<typename... Args> | |
| Arc * | emplace_arc (Node *src, Node *tgt, Args &&... args) |
| Insert a new arc in the graph by constructing its associated data in-place with the given args. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, typename Aleph::graph_dry_detail::node_curr<GT, Operation>::type> | |
| bool | traverse_nodes (Operation &op) const |
| Conditioned traversal of all the nodes of a graph. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, typename Aleph::graph_dry_detail::node_curr<GT, Operation>::type> | |
| bool | traverse_nodes (Operation &&op=Operation()) const |
Overload of traverse_nodes(Operation&) that accepts rvalues. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, typename Aleph::graph_dry_detail::arc_curr<GT, Operation>::type> | |
| bool | traverse_arcs (Operation &op) const |
| Conditioned traversal of all the arcs of a graph. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, typename Aleph::graph_dry_detail::arc_curr<GT, Operation>::type> | |
| bool | traverse_arcs (Operation &&op=Operation()) const |
Overload of traverse_arcs(Operation&) that accepts rvalues. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, typename Aleph::graph_dry_detail::node_arc_curr<GT, Operation>::type> | |
| bool | traverse_arcs (Node *p, Operation &op) const |
| Conditioned traversal of all the adjacent arcs of a node. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, typename Aleph::graph_dry_detail::node_arc_curr<GT, Operation>::type> | |
| bool | traverse_arcs (Node *p, Operation &&op=Operation()) const |
Overload of traverse_arcs(Node*, Operation&) that accepts rvalues. | |
| template<class Operation > requires Aleph::CallableWith<Operation &, typename Aleph::graph_dry_detail::node_curr<GT, Operation>::type> | |
| void | for_each_node (Operation &operation) const |
| Unconditionally traverse all the nodes of graph and on each one perform an operation. | |
| template<class Operation > requires Aleph::CallableWith<Operation &, typename Aleph::graph_dry_detail::node_curr<GT, Operation>::type> | |
| void | for_each_node (Operation &&operation=Operation()) const |
Overload of for_each_node(Operation&) that accepts rvalues. | |
| template<class Operation > requires Aleph::CallableWith<Operation &, typename Aleph::graph_dry_detail::arc_curr<GT, Operation>::type> | |
| void | for_each_arc (Operation &op) const |
| Unconditionally traverse all the arcs of graph and on each one perform an operation. | |
| template<class Operation > requires Aleph::CallableWith<Operation &, typename Aleph::graph_dry_detail::arc_curr<GT, Operation>::type> | |
| void | for_each_arc (Operation &&operation=Operation()) const |
Overload of for_each_arc(Operation&) that accepts rvalues. | |
| template<class Operation > requires Aleph::CallableWith<Operation &, typename Aleph::graph_dry_detail::node_arc_curr<GT, Operation>::type> | |
| void | for_each_arc (Node *p, Operation &op) const |
| Unconditionally traverse all the arcs adjacnt to a node and on each one perform an operation. | |
| template<class Operation > requires Aleph::CallableWith<Operation &, typename Aleph::graph_dry_detail::node_arc_curr<GT, Operation>::type> | |
| void | for_each_arc (Node *p, Operation &&op=Operation()) const |
Overload of for_each_arc(Node*, Operation&) that accepts rvalues. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, typename Aleph::graph_dry_detail::node_curr<GT, Operation>::type> | |
| bool | all_nodes (Operation &op) const |
| Check if all the nodes of graph satisfy an boolean condition. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, typename Aleph::graph_dry_detail::node_curr<GT, Operation>::type> | |
| bool | all_nodes (Operation &&op=Operation()) const |
Overload of all_nodes(Operation&) that accepts rvalues. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, typename Aleph::graph_dry_detail::arc_curr<GT, Operation>::type> | |
| bool | all_arcs (Operation &op) const |
| Check if all the arcs of graph satisfy a boolean condition. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, typename Aleph::graph_dry_detail::arc_curr<GT, Operation>::type> | |
| bool | all_arcs (Operation &&op=Operation()) const |
Overload of all_arcs(Operation&) that accepts rvalues. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, typename Aleph::graph_dry_detail::node_arc_curr<GT, Operation>::type> | |
| bool | all_arcs (Node *p, Operation &op) const |
| Check if all the arcs adjacent to a node satisfy an boolean condition. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, typename Aleph::graph_dry_detail::node_arc_curr<GT, Operation>::type> | |
| bool | all_arcs (Node *p, Operation &&op=Operation()) const |
Overload of all_arcs(Node*, Operation&) that accepts rvalues. | |
| template<typename T = Node_Type, class Op > requires std::is_invocable_r_v<T, Op &, Node *> | |
| auto | nodes_map (Op op) const |
| Map the nodes of a graph to a specific range. | |
| template<typename T = Arc_Type, class Op > requires std::is_invocable_r_v<T, Op &, Arc *> | |
| auto | arcs_map (Op operation) const |
| Map the arcs of a graph to a specific range. | |
| template<typename T = Arc_Type, class Op > requires std::is_invocable_r_v<T, Op &, Arc *> | |
| auto | arcs_map (Node *p, Op operation) const |
| Map the adjacent arcs of a node to a specific range. | |
| template<typename T = Node_Type, class Op > requires std::is_invocable_r_v<T, Op &, const T &, Node *> | |
| T | foldl_nodes (const T &init, Op op) const |
| Folding of nodes on a graph. | |
| template<typename T = Arc_Type, class Op > requires std::is_invocable_r_v<T, Op &, const T &, Arc *> | |
| T | foldl_arcs (const T &init, Op op) const |
| Folding of arcs on a graph. | |
| template<typename T = Arc_Type, class Op > requires std::is_invocable_r_v<T, Op &, const T &, Arc *> | |
| T | foldl_arcs (Node *p, const T &init, Op op) const |
| Folding of arcs of a node. | |
| template<class Op > requires Aleph::PredicateWith<Op &, Node *&> | |
| auto | filter_nodes (Op &op) const |
| Filter the nodes satisfying a condition. | |
| template<class Op > requires Aleph::PredicateWith<Op &, Node *&> | |
| auto | filter_nodes (Op &&op) const |
Overload of filter_nodes(Op&) that accepts rvalues. | |
| template<class Op > requires Aleph::PredicateWith<Op &, Arc *&> | |
| auto | filter_arcs (Op &op) const |
| Filter the arcs of graph satisfying a condition. | |
| template<class Op > requires Aleph::PredicateWith<Op &, Arc *&> | |
| auto | filter_arcs (Op &&op) const |
Overload of filter_arcs(Op&) that accepts rvalues. | |
| template<class Op > requires Aleph::PredicateWith<Op &, Arc *&> | |
| auto | filter_arcs (Node *p, Op &op) const |
| Filter the arcs adjacent to a node satisfying a condition. | |
| template<class Op > requires Aleph::PredicateWith<Op &, Arc *&> | |
| auto | filter_arcs (Node *p, Op &&op) const |
Overload of filter_arcs(Node*, Op&) that accepts rvalues. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, Node *&> | |
| bool | exists_node (Operation &op) const |
| Determine if exists at least a node satisfying a condition. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, Node *&> | |
| bool | exists_node (Operation &&op=Operation()) const |
Overload of exists_node(Operation&) that accepts rvalues. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, Arc *&> | |
| bool | exists_arc (Operation &op) const |
| Determine if exists at least a arc satisfying a condition. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, Arc *&> | |
| bool | exists_arc (Operation &&op=Operation()) const |
Overload of exists_arc(Operation&) that accepts rvalues. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, Arc *&> | |
| bool | exists_arc (Node *p, Operation &op) const |
| Determine if exists at least a arc adjacent to a node satisfying a condition. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, Arc *&> | |
| bool | exists_arc (Node *p, Operation &&op=Operation()) const |
Overload of exists_arc(Node*, Operation&) that accepts rvalues. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, Node *&> | |
| bool | none_node (Operation &op) const |
| Determine if no node satisfies a condition. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, Node *&> | |
| bool | none_node (Operation &&op) const |
Overload of none_node(Operation&) that accepts rvalues. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, Arc *&> | |
| bool | none_arc (Operation &op) const |
| Determine if no arc satisfies a condition. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, Arc *&> | |
| bool | none_arc (Operation &&op) const |
Overload of none_arc(Operation&) that accepts rvalues. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, Arc *&> | |
| bool | none_arc (Node *p, Operation &op) const |
| Determine if no arc adjacent to a node satisfies a condition. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, Arc *&> | |
| bool | none_arc (Node *p, Operation &&op) const |
Overload of none_arc(Node*, Operation&) that accepts rvalues. | |
| template<class Operation = std::function<bool(Node*)>> requires Aleph::PredicateWith<Operation &, Node *&> | |
| size_t | count_nodes (Operation op=[](Node *) { return true;}) const |
| Count the nodes satisfying a condition. | |
| template<class Operation = std::function<bool(Arc*)>> requires Aleph::PredicateWith<Operation &, Arc *&> | |
| size_t | count_arcs (Operation op=[](Arc *) { return true;}) const |
| Count the arcs satisfying a condition. | |
| template<class Operation = std::function<bool(Arc*)>> requires Aleph::PredicateWith<Operation &, Arc *&> | |
| size_t | count_arcs (Node *p, Operation op=[](Arc *) { return true;}) const |
| Count arcs adjacent to a node satisfying a condition. | |
| template<typename T = double, class Extract > requires requires(T &sum, Extract &extract, Arc *a) { sum += extract(a); } | |
| T | sum_arcs (Node *p, Extract extract) const |
| Sum values derived from arcs adjacent to a node. | |
| template<typename T = double> | |
| T | sum_arcs (Node *p) const |
Overload of sum_arcs(Node*, Extract) using the arc info as extractor. | |
| template<class Compare = std::function<bool(Arc*, Arc*)>> requires Aleph::PredicateWith<Compare &, Arc *&, Arc *&> | |
| Arc * | min_arc (Node *p, Compare cmp=[](Arc *a, Arc *b) { return a->get_info()< b->get_info();}) const |
| Find the minimum arc adjacent to a node. | |
| template<class Compare = std::function<bool(Arc*, Arc*)>> requires Aleph::PredicateWith<Compare &, Arc *&, Arc *&> | |
| Arc * | max_arc (Node *p, Compare cmp=[](Arc *a, Arc *b) { return a->get_info()< b->get_info();}) const |
| Find the maximum arc adjacent to a node. | |
| template<class Compare = std::function<bool(Arc*, Arc*)>> requires Aleph::PredicateWith<Compare &, Arc *&, Arc *&> | |
| Arc * | min_arc (Compare cmp=[](Arc *a, Arc *b) { return a->get_info()< b->get_info();}) const |
| Find the minimum arc in the entire graph. | |
| template<class Compare = std::function<bool(Arc*, Arc*)>> requires Aleph::PredicateWith<Compare &, Arc *&, Arc *&> | |
| Arc * | max_arc (Compare cmp=[](Arc *a, Arc *b) { return a->get_info()< b->get_info();}) const |
| Find the maximum arc in the entire graph. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, Node *&> | |
| std::pair< DynList< Node * >, DynList< Node * > > | partition_nodes (Operation op) const |
| Partition nodes into two groups based on a predicate. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, Arc *&> | |
| std::pair< DynList< Arc * >, DynList< Arc * > > | partition_arcs (Operation op) const |
| Partition arcs into two groups based on a predicate. | |
| DynList< Node * > | adjacent_nodes (Node *p) const |
| Get all adjacent nodes (neighbors) of a node. | |
| template<class Op > requires Aleph::PredicateWith<Op &, std::decay_t<typename Aleph::graph_dry_detail::node_curr<GT, Op>::type> &> | |
| Node * | search_node (Op &op) const |
| Linear search of a node. | |
| template<class Op > requires Aleph::PredicateWith<Op &, std::decay_t<typename Aleph::graph_dry_detail::node_curr<GT, Op>::type> &> | |
| Node * | search_node (Op &&op) const |
Overload of search_node(Op&) that accepts rvalues. | |
| Node * | find_node (const Node_Type &info) const noexcept(noexcept(static_cast< bool >(std::declval< Node_Type & >()==std::declval< const Node_Type & >()))) |
| Find a node mathing a content. | |
| template<class Op > requires Aleph::PredicateWith<Op &, std::decay_t<typename Aleph::graph_dry_detail::arc_curr<GT, Op>::type> &> | |
| Arc * | search_arc (Op &op) const |
| Linear search of an arc. | |
| template<class Op > requires Aleph::PredicateWith<Op &, std::decay_t<typename Aleph::graph_dry_detail::arc_curr<GT, Op>::type> &> | |
| Arc * | search_arc (Op &&op) const |
Overload of search_arc(Op&) that accepts rvalues. | |
| Arc * | find_arc (const Arc_Type &info) const noexcept(noexcept(static_cast< bool >(std::declval< Arc_Type & >()==std::declval< const Arc_Type & >()))) |
| Find an arc mathing a content. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, Arc *&> | |
| Arc * | search_arc (Node *p, Operation &op) const |
| Linear search of an arc. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, Arc *&> | |
| Arc * | search_arc (Node *p, Operation &&op=Operation()) const |
Overload of search_arc(Node*, Operation&) that accepts rvalues. | |
| Arc * | search_arc (Node *src, Node *tgt) const noexcept |
| Search an arc linking two nodes. | |
| template<template< typename > class Container = Aleph::DynList> | |
| Container< Node * > | nodes () const |
| Return a container with all the nodes of the graph. | |
| template<template< typename > class Container = Aleph::DynList> | |
| Container< Arc * > | arcs () const |
| Return a container with all the arcs of the graph. | |
| template<template< typename > class Container = Aleph::DynList> | |
| Container< Arc * > | arcs (Node *p) const |
| Return a container with all the arcs adjacent to a node. | |
| auto | get_node_it () const noexcept |
| Obtains an iterator to the nodes of graph. | |
| auto | get_arc_it () const noexcept |
| Obtains an iterator to the arc of graph. | |
| auto | get_arc_it (Node *p) const noexcept |
| Obtains an iterator to the adjacent arcs of a node. | |
| In_Iterator | get_in_it (Node *p) const |
Return an input iterator on the incoming arcs to p | |
| Out_Iterator | get_out_it (Node *p) const noexcept |
Return an output iterator on the incoming nodes to p | |
| Arc * | search_directed_arc (Node *src, Node *tgt) const noexcept |
| Search a directed arc linking two nodes. | |
| DynList< Node * > | in_nodes (Node *p) const |
Return a list with the incoming nodes to p | |
| DynList< Node * > | out_nodes (Node *p) const |
Return a list with the outcoming nodes to p | |
| DynList< Arc * > | out_arcs (Node *p) const |
| Return a list with the outcoming arcs to p`. | |
| DynList< Arc * > | in_arcs (Node *p) const |
Return a list with the incoming arcs to p | |
| auto | in_pairs (Node *p) const |
| Return a list of pair incoming arcs and nodes. | |
| auto | out_pairs (Node *p) const |
| Return a list of pair outcoming arcs and nodes. | |
| size_t | in_degree (Node *p) const noexcept |
| Compute the input degree of a node. | |
| size_t | out_degree (Node *p) const noexcept |
| Compute the output degree of a node. | |
| template<class Itor , class Operation > requires Aleph::PredicateWith<Operation &, decltype(std::declval<Itor &>().get_curr())> | |
| bool | traverse_arcs (Node *p, Operation &op) const |
| Traverse of arcs of a node according to specific arcs iterator. | |
| template<class Itor , class Operation > requires Aleph::CallableWith<Operation &, decltype(std::declval<Itor &>().get_curr())> | |
| void | for_each_arc (Node *p, Operation &op) const |
Perform op on each arc of node p | |
| template<class Op > | |
| bool | traverse_in_arcs (Node *p, Op &op) const |
Traverse the incoming arcs of node p executing the conditioned operation. | |
| template<class Op > | |
| bool | traverse_in_arcs (Node *p, Op &&op=Op()) const |
Overload of traverse_in_arcs(Node*, Op&) that accepts rvalues. | |
| template<class Op > | |
| void | for_each_in_arc (Node *p, Op &op) const |
Perform op on each incoming arc of node p; on a digraph, among the arcs of the graph, in \(O(E)\). | |
| template<class Op > | |
| void | for_each_in_arc (Node *p, Op &&op=Op()) const |
Overload of for_each_in_arc(Node*, Op&) that accepts rvalues. | |
| template<class Op > | |
| bool | all_in_arcs (Node *p, Op &op) const |
Return true if op is true for all the incoming arcs to node p | |
| template<class Op > | |
| bool | all_in_arcs (Node *p, Op &&op=Op()) const |
Overload of all_in_arcs(Node*, Op&) that accepts rvalues. | |
| template<class Op > | |
| bool | exists_in_arc (Node *p, Op &op) const |
Return true if it exists a incoming arc to p returning true for op | |
| template<class Op > | |
| bool | exists_in_arc (Node *p, Op &&op=Op()) const |
Overload of exists_in_arc(Node*, Op&) that accepts rvalues. | |
| template<class Op > | |
| auto | search_in_arc (Node *p, Op &op) const |
| Search an incoming arc to a node satisfaying a condition. | |
| template<class Op > | |
| auto | search_in_arc (Node *p, Op &&op=Op()) const |
Overload of search_in_arc(Node*, Op&) that accepts rvalues. | |
| template<typename T , class Op > requires std::is_invocable_r_v<T, Op &, Arc *> | |
| auto | in_arcs_map (Node *p, Op op) const |
Return a list of incoming arcs of a node mapped to items of type given by transformation op. | |
| template<typename T = Arc_Type, class Op > requires std::is_invocable_r_v<T, Op &, const T &, Arc *> | |
| T | foldl_in_arcs (Node *p, const T &init, Op op) const |
| Fold the incoming arcs of a node. | |
| template<class Op > | |
| DynList< Arc * > | filter_in_arcs (Node *p, Op &op) const |
| Filter the incoming arcs of a node. | |
| template<class Op > | |
| auto | filter_in_arcs (Node *p, Op &&op=Op()) const |
Overload of filter_in_arcs(Node*, Op&) that accepts rvalues. | |
| template<class Op > | |
| bool | traverse_out_arcs (Node *p, Op &op) const |
Traverse the outcoming arcs of node p executing the conditioned operation | |
| template<class Op > | |
| bool | traverse_out_arcs (Node *p, Op &&op=Op()) const |
Overload of traverse_out_arcs(Node*, Op&) that accepts rvalues. | |
| template<class Op > | |
| void | for_each_out_arc (Node *p, Op &op) const |
Perform op on each outcoming arc of node p | |
| template<class Op > | |
| void | for_each_out_arc (Node *p, Op &&op=Op()) const |
Overload of for_each_out_arc(Node*, Op&) that accepts rvalues. | |
| template<class Op > | |
| bool | all_out_arcs (Node *p, Op &op) const |
Return true if op is true for all the outcoming arcs to node p | |
| template<class Op > | |
| bool | all_out_arcs (Node *p, Op &&op=Op()) const |
Overload of all_out_arcs(Node*, Op&) that accepts rvalues. | |
| template<class Op > | |
| bool | exists_out_arc (Node *p, Op &op) const |
Return true if it exists a outcoming arc to p returning true for op | |
| template<class Op > | |
| bool | exists_out_arc (Node *p, Op &&op=Op()) const |
Overload of exists_out_arc(Node*, Op&) that accepts rvalues. | |
| template<class Op > | |
| auto | search_out_arc (Node *p, Op &op) const |
| Search an outcoming arc to a node satisfaying a condition. | |
| template<class Op > | |
| auto | search_out_arc (Node *p, Op &&op=Op()) const |
Overload of search_out_arc(Node*, Op&) that accepts rvalues. | |
| template<typename T = Arc_Type, class Op > requires std::is_invocable_r_v<T, Op &, Arc *> | |
| auto | out_arcs_map (Node *p, Op op) const |
Return a list of outcoming arcs of a node mapped to items of type given by transformation op. | |
| template<typename T = Arc_Type, class Op > requires std::is_invocable_r_v<T, Op &, const T &, Arc *> | |
| T | foldl_out_arcs (Node *p, const T &init, Op op) const |
| Fold-left over outcoming arcs of a node. | |
| template<class Op > | |
| DynList< Arc * > | filter_out_arcs (Node *p, Op &op) const |
| Filter the outcoming arcs of a node. | |
| template<class Op > | |
| auto | filter_out_arcs (Node *p, Op &&op=Op()) const |
Overload of filter_out_arcs(Node*, Op&) that accepts rvalues. | |
| template<class Compare > requires (has_node_dlink_v<GT>) | |
| void | sort_nodes (Compare &cmp) noexcept(nothrow_cmp_v< Compare, Node >) |
| Sort all the nodes of the graph according to a specific criteria. | |
| template<class Compare > requires (has_node_dlink_v<GT>) | |
| void | sort_nodes (Compare &&cmp=Compare()) noexcept(nothrow_cmp_v< Compare, Node >) |
See sort_nodes(Compare & cmp). | |
| template<class Compare > requires (has_arc_dlink_v<GT>) | |
| void | sort_arcs (Compare &cmp) noexcept(nothrow_cmp_v< Compare, Arc >) |
| Sort all the arcs of the graph according to a specific criteria. | |
| template<class Compare > requires (has_arc_dlink_v<GT>) | |
| void | sort_arcs (Compare &&cmp=Compare()) noexcept(nothrow_cmp_v< Compare, Arc >) |
See sort_arcs(Compare & cmp). | |
Static Public Member Functions | |
| static Flow_Type | node_tolerance (const Flow_Type &in, const Flow_Type &out) noexcept |
The tolerance of rounding of the flow of a node whose flows into and out of it are in and out. | |
Static Public Member Functions inherited from GraphCommon< GT, Node, Arc > | |
| template<class N1 , class N2 = N1> | |
| static void | map_nodes (N1 *p, N2 *q) noexcept |
| Map the nodes through their cookies. | |
| template<class A1 , class A2 = A1> | |
| static void | map_arcs (A1 *p, A2 *q) noexcept |
| Map the arcs through their cookies. | |
Public Attributes | |
| Flow_Type | Infinity |
| bool | with_super_source |
| True if the network has a super-source. | |
| bool | with_super_sink |
| True if the network has a super-sink. | |
Protected Member Functions | |
| void | swap_contents (Net_Graph &other) noexcept |
Exchange the nodes, the arcs and the rest of the state of this network with those of other, as swap() does, without calling swapped(). | |
| virtual void | swapped () noexcept |
| What swap() calls on each of its two networks, once their nodes and arcs are exchanged: nothing, in Net_Graph. | |
Protected Member Functions inherited from GraphCommon< GT, Node, Arc > | |
| void | init () noexcept |
| void | common_swap (GT &g) noexcept |
| template<class Predicate > | |
| DynList< Arc * > | collect_arcs_if (Predicate pred) const |
| Collect all arcs matching a predicate. | |
| template<class Predicate > | |
| void | remove_arcs_if (Predicate pred) |
| Remove all arcs matching a predicate. | |
Private Member Functions | |
| Flow_Type | nodes_tolerance () const |
| bool | same_totals (const Flow_Type &out, const Flow_Type &in) const |
| Flow_Type | total_source_out_flow () const |
| Return total outgoing flow from all sources. | |
| Flow_Type | total_sink_in_flow () const |
| Return total incoming flow to all sinks. | |
| Node * | register_node (Node *p) |
Insert p into source/sink sets with rollback on failure. | |
| void | register_ends_of_leaving (Arc *arc) |
Static Private Member Functions | |
| static Flow_Type | check_tolerance (const Flow_Type &in, const Flow_Type &out) noexcept |
Private Attributes | |
| DynSetTree< Node * > | src_nodes |
| DynSetTree< Node * > | sink_nodes |
| Node * | super_source_node = nullptr |
| Node * | super_sink_node = nullptr |
Friends | |
| std::ostream & | operator<< (std::ostream &s, const Path< Net_Graph > &path) |
| Stream a path with arc (cap,flow) tuples. | |
Additional Inherited Members | |
Static Public Attributes inherited from GraphCommon< GT, Node, Arc > | |
| template<class U > | |
| static constexpr bool | has_node_dlink_v |
Whether U::get_node_dlink() returns a Dlink &. | |
| template<class U > | |
| static constexpr bool | has_arc_dlink_v |
| template<class Compare , class T > | |
| static constexpr bool | nothrow_cmp_v |
Protected Attributes inherited from GraphCommon< GT, Node, Arc > | |
| void * | cookie = nullptr |
| size_t | num_nodes = 0 |
| size_t | num_arcs = 0 |
| bool | digraph = false |
Flow network implemented with adjacency lists.
Net_Graph models a capacitated network, the main data structure for maximum-flow algorithms and related graph routines.
Template parameters:
| using Aleph::Net_Graph< NodeT, ArcT >::Arc = ArcT |
| using Aleph::Net_Graph< NodeT, ArcT >::Arc_Type = typename Arc::Arc_Type |
| using Aleph::Net_Graph< NodeT, ArcT >::Base = Array_Graph<NodeT, ArcT> |
| using Aleph::Net_Graph< NodeT, ArcT >::Flow_Type = typename Arc::Flow_Type |
| using Aleph::Net_Graph< NodeT, ArcT >::Graph = Base |
| using Aleph::Net_Graph< NodeT, ArcT >::Net = Net_Graph<NodeT, ArcT> |
| using Aleph::Net_Graph< NodeT, ArcT >::Node = NodeT |
| using Aleph::Net_Graph< NodeT, ArcT >::Node_Type = typename Node::Node_Type |
|
inline |
Copy-construct a network. Throws bad_alloc on allocation failure.
Definition at line 953 of file tpl_net.H.
References GraphCommon< GT, Node, Arc >::arcs(), Aleph::copy_graph(), GTNodeIterator< GT >::get_curr(), Aleph::Net_Graph< NodeT, ArcT >::super_sink_node, Aleph::Net_Graph< NodeT, ArcT >::super_source_node, and Aleph::zip().
|
inlinenoexcept |
Move-construct a network. O(1) operation.
Definition at line 1042 of file tpl_net.H.
References Aleph::Net_Graph< NodeT, ArcT >::swap_contents().
|
inline |
|
inline |
Validate flow-conservation and capacity constraints.
A floating flow is valid but for rounding: every node keeps its flow within node_tolerance() of its own flows, and the flow out of the sources and that into the sinks differ at most by the sum of those tolerances. Equal flows, also infinite ones, as those of a path of arcs of infinite capacity, balance; an infinite flow and a finite one do not.
Definition at line 1116 of file tpl_net.H.
References Aleph::and, GraphCommon< GT, Node, Arc >::arcs(), Aleph::Net_Graph< NodeT, ArcT >::check_node(), Aleph::DynSetTree< Key, Tree, Compare >::is_empty(), GraphCommon< GT, Node, Arc >::nodes(), Aleph::Net_Graph< NodeT, ArcT >::same_totals(), Aleph::Net_Graph< NodeT, ArcT >::sink_nodes, Aleph::Net_Graph< NodeT, ArcT >::src_nodes, Aleph::Net_Graph< NodeT, ArcT >::total_sink_in_flow(), and Aleph::Net_Graph< NodeT, ArcT >::total_source_out_flow().
Referenced by Aleph::aumenting_path_maximum_flow(), Aleph::generic_preflow_vertex_push_maximum_flow(), Aleph::increase_flow(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inlinenoexcept |
Return true if node satisfies flow conservation constraints.
A floating flow keeps them but for rounding, within node_tolerance() of the flows of the node. Flows that are equal balance, also infinite ones, as those of a node of a path of arcs of infinite capacity; an infinite flow and a finite one do not.
Definition at line 468 of file tpl_net.H.
References Aleph::and, Aleph::Net_Graph< NodeT, ArcT >::check_tolerance(), Aleph::Net_Graph< NodeT, ArcT >::get_in_flow(), Aleph::Net_Graph< NodeT, ArcT >::get_out_flow(), Aleph::Net_Graph< NodeT, ArcT >::is_connected(), Aleph::Net_Graph< NodeT, ArcT >::is_sink(), and Aleph::Net_Graph< NodeT, ArcT >::is_source().
Referenced by Aleph::Net_Graph< NodeT, ArcT >::check_network(), and TEST().
|
inlinestaticprivatenoexcept |
Definition at line 513 of file tpl_net.H.
References Aleph::Net_Graph< NodeT, ArcT >::node_tolerance(), and out.
Referenced by Aleph::Net_Graph< NodeT, ArcT >::check_node(), Aleph::Net_Graph< NodeT, ArcT >::nodes_tolerance(), and Aleph::Net_Graph< NodeT, ArcT >::same_totals().
|
inline |
Connect a previously disconnected arc.
The arc must already belong to the graph; no verification is performed. Multigraphs are supported (no check for existing arcs).
| [in] | arc | Arc to connect. |
Definition at line 832 of file tpl_net.H.
References Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::connect_arc(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::DynSetTree< Key, Tree, Compare >::remove(), Aleph::Net_Graph< NodeT, ArcT >::sink_nodes, and Aleph::Net_Graph< NodeT, ArcT >::src_nodes.
Referenced by TEST(), TEST(), TEST_F(), and Aleph::vertex_connectivity().
|
inlinevirtual |
Disconnect arc arc from the graph without deleting it.
Virtual, as remove_arc(): a derived network that keeps something for its arcs, as Net_Cap_Graph its auxiliary network, learns that one left also through a reference to Net_Graph.
| [in] | arc | Arc to disconnect. |
| bad_alloc | as remove_arc(). |
Reimplemented in Aleph::Net_Cap_Graph< NodeT, ArcT >.
Definition at line 921 of file tpl_net.H.
References Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::disconnect_arc(), and Aleph::Net_Graph< NodeT, ArcT >::register_ends_of_leaving().
Referenced by Aleph::Net_Cap_Graph< NodeT, ArcT >::disconnect_arc(), TEST(), TEST(), TEST(), TEST_F(), and Aleph::vertex_connectivity().
|
inline |
Construct arc info in-place and insert the arc.
Definition at line 818 of file tpl_net.H.
References Aleph::Net_Graph< NodeT, ArcT >::insert_arc().
Referenced by test_graph().
|
inline |
Construct a node in-place and insert it into the network.
Definition at line 769 of file tpl_net.H.
References Aleph::Net_Graph< NodeT, ArcT >::insert_node().
Referenced by test_graph().
|
inline |
Return the total flow value of the network: the flow out of its sources, which a valid flow also takes into its sinks, as check_network() takes them.
Definition at line 1139 of file tpl_net.H.
References ah_domain_error_if, Aleph::DynSetTree< Key, Tree, Compare >::is_empty(), Aleph::Net_Graph< NodeT, ArcT >::same_totals(), Aleph::Net_Graph< NodeT, ArcT >::sink_nodes, Aleph::Net_Graph< NodeT, ArcT >::src_nodes, Aleph::Net_Graph< NodeT, ArcT >::total_sink_in_flow(), and Aleph::Net_Graph< NodeT, ArcT >::total_source_out_flow().
Referenced by Aleph::capacity_scaling_maximum_flow(), Aleph::compute_flow_statistics(), Aleph::dinic_maximum_flow(), Aleph::generic_preflow_vertex_push_maximum_flow(), Aleph::Net_Cap_Graph< NodeT, ArcT >::get_total_flow(), Aleph::hlpp_maximum_flow(), Aleph::min_cut(), print_flow_stats(), Aleph::net_detail::refuse_infinite_maximum_flow(), Aleph::successive_shortest_paths(), TEST(), TEST(), and TEST().
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Return total incoming capacity of node.
Definition at line 369 of file tpl_net.H.
References Aleph::Digraph_Iterator< GT, Filter >::has_curr(), and Aleph::sum().
Referenced by Aleph::Net_Graph< NodeT, ArcT >::make_super_sink().
|
inlinenoexcept |
Return the in-degree of p (number of incoming arcs).
Definition at line 387 of file tpl_net.H.
References GraphCommon< GT, Node, Arc >::in_degree().
Referenced by Aleph::check_baseball_elimination(), Aleph::Net_Sup_Dem_Graph< NodeT, ArcT >::compute_aux_net(), Aleph::Net_Graph< NodeT, ArcT >::is_connected(), Aleph::Net_Graph< NodeT, ArcT >::register_ends_of_leaving(), and TEST().
|
inlinenoexcept |
Return total incoming flow of node.
Definition at line 408 of file tpl_net.H.
References Aleph::Digraph_Iterator< GT, Filter >::has_curr(), and Aleph::sum().
Referenced by Aleph::Net_Graph< NodeT, ArcT >::check_node(), Aleph::decompose_flow(), Aleph::generic_preflow_vertex_push_maximum_flow(), Aleph::is_node_active(), Aleph::Net_Graph< NodeT, ArcT >::nodes_tolerance(), Aleph::net_detail::not_short(), Aleph::preflow_create_residual_net(), and Aleph::Net_Graph< NodeT, ArcT >::total_sink_in_flow().
|
inlinenoexcept |
Return total outgoing capacity of node.
Definition at line 378 of file tpl_net.H.
References Aleph::Digraph_Iterator< GT, Filter >::has_curr(), and Aleph::sum().
Referenced by Aleph::Net_Graph< NodeT, ArcT >::make_super_source().
|
inlinenoexcept |
Return the out-degree of p (number of outgoing arcs).
Definition at line 393 of file tpl_net.H.
References GraphCommon< GT, Node, Arc >::out_degree().
Referenced by Aleph::Net_Sup_Dem_Graph< NodeT, ArcT >::compute_aux_net(), Aleph::Net_Graph< NodeT, ArcT >::is_connected(), Aleph::Net_Graph< NodeT, ArcT >::register_ends_of_leaving(), and TEST().
|
inlinenoexcept |
Return total outgoing flow of node.
Definition at line 399 of file tpl_net.H.
References Aleph::Digraph_Iterator< GT, Filter >::has_curr(), and Aleph::sum().
Referenced by Aleph::aumenting_path_maximum_flow(), Aleph::Net_Graph< NodeT, ArcT >::check_node(), Aleph::decompose_flow(), demo_compare_algorithms_on_logistics(), demo_mincost_maxflow(), Aleph::generic_preflow_vertex_push_maximum_flow(), Aleph::is_node_active(), Aleph::Net_Graph< NodeT, ArcT >::nodes_tolerance(), Aleph::net_detail::not_short(), Aleph::preflow_create_residual_net(), and Aleph::Net_Graph< NodeT, ArcT >::total_source_out_flow().
|
inline |
Return an arbitrary sink node.
Definition at line 739 of file tpl_net.H.
References Aleph::DynSetTree< Key, Tree, Compare >::get_item(), and Aleph::Net_Graph< NodeT, ArcT >::sink_nodes.
Referenced by Aleph::aumenting_path_maximum_flow(), Aleph::capacity_scaling_maximum_flow(), compute_min_cut_capacity(), Aleph::decompose_flow(), Aleph::dinic_maximum_flow(), Aleph::export_network_to_dimacs(), Aleph::export_network_to_dot(), Aleph::export_network_to_json(), Aleph::Find_Aumenting_Path< Net, Q >::find_aum_path(), Aleph::find_aumenting_path(), Aleph::Find_Aumenting_Path< Net, Q >::find_dec_path(), Aleph::generic_preflow_vertex_push_maximum_flow(), Aleph::hlpp_maximum_flow(), Aleph::net_detail::infinite_arc_preflow(), Aleph::init_height_in_nodes(), Aleph::max_flow_min_cost_by_cycle_canceling(), Aleph::network_to_dot_string(), Aleph::network_to_json_string(), Aleph::preflow_create_residual_net(), print_network(), Aleph::successive_shortest_paths(), TEST(), TEST(), and TEST().
|
inlinenoexcept |
Return the set of sink nodes.
Definition at line 595 of file tpl_net.H.
References Aleph::Net_Graph< NodeT, ArcT >::sink_nodes.
Referenced by Aleph::Net_Sup_Dem_Graph< NodeT, ArcT >::compute_aux_net(), Aleph::solve_circulation(), Aleph::solve_transshipment(), TEST(), and TEST().
|
inline |
Return an arbitrary source node.
Definition at line 733 of file tpl_net.H.
References Aleph::DynSetTree< Key, Tree, Compare >::get_item(), and Aleph::Net_Graph< NodeT, ArcT >::src_nodes.
Referenced by Aleph::aumenting_path_maximum_flow(), Aleph::build_residual_net(), Aleph::capacity_scaling_maximum_flow(), compute_min_cut_capacity(), Aleph::decompose_flow(), demo_compare_algorithms_on_logistics(), demo_mincost_maxflow(), demonstrate_flow_decomposition(), Aleph::dinic_maximum_flow(), Aleph::export_network_to_dimacs(), Aleph::export_network_to_dot(), Aleph::export_network_to_json(), Aleph::net_detail::fill_infinite_path(), Aleph::Find_Aumenting_Path< Net, Q >::find_aum_path(), Aleph::find_aumenting_path(), Aleph::Find_Aumenting_Path< Net, Q >::find_dec_path(), Aleph::generic_preflow_vertex_push_maximum_flow(), Aleph::hlpp_maximum_flow(), Aleph::max_flow_min_cost_by_cycle_canceling(), Aleph::min_cut(), Aleph::network_to_dot_string(), Aleph::network_to_json_string(), Aleph::preflow_create_residual_net(), print_network(), Aleph::successive_shortest_paths(), TEST(), TEST(), and TEST().
|
inlinenoexcept |
Return the set of source nodes.
Definition at line 589 of file tpl_net.H.
References Aleph::Net_Graph< NodeT, ArcT >::src_nodes.
Referenced by Aleph::Net_Sup_Dem_Graph< NodeT, ArcT >::compute_aux_net(), Aleph::solve_circulation(), Aleph::solve_transshipment(), and TEST().
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
Insert an arc with zero capacity and flow, for an arc info that is arithmetic or of the type of the flow.
The overload above is disabled for those types, and copy_graph(), which the copy constructor uses, inserts the arcs with two arguments.
Definition at line 871 of file tpl_net.H.
References Aleph::Net_Graph< NodeT, ArcT >::insert_arc().
|
inline |
Insert an arc with zero capacity and flow.
This overload is disabled when Arc_Type equals Flow_Type to avoid a signature clash with the capacity-only overload. It is also disabled for arithmetic types to ensure that integer literals match the capacity overload instead.
Definition at line 858 of file tpl_net.H.
References Aleph::Net_Graph< NodeT, ArcT >::insert_arc().
|
inline |
Insert an arc with capacity cap and zero flow.
Definition at line 846 of file tpl_net.H.
References Aleph::Net_Graph< NodeT, ArcT >::insert_arc().
|
inline |
Insert a capacitated arc with an initial flow.
| [in] | src_node | Source node. |
| [in] | tgt_node | Target node. |
| [in] | cap | Capacity value. |
| [in] | flow | Flow value. |
| [in] | arc_info | Arc info to store. |
| bad_alloc | If there is not enough memory. |
| overflow_error | If flow exceeds cap or is negative. The network is then as it was. |
Definition at line 799 of file tpl_net.H.
References ah_overflow_error_if, Aleph::and, Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::insert_arc(), Aleph::DynSetTree< Key, Tree, Compare >::remove(), Aleph::Net_Graph< NodeT, ArcT >::sink_nodes, and Aleph::Net_Graph< NodeT, ArcT >::src_nodes.
Referenced by add_super_source_and_sink(), build_antiparallel_network(), build_datacenter_network(), build_grid_network(), build_supply_chain(), build_tenths_network(), build_water_network(), Aleph::check_baseball_elimination(), Aleph::Net_Sup_Dem_Graph< NodeT, ArcT >::compute_aux_net(), Aleph::Net_Cap_Graph< NodeT, ArcT >::compute_aux_net(), Aleph::compute_min_cut(), demo_dot_export(), demonstrate_bipartite_matching(), Aleph::design_survey(), Aleph::edge_connectivity(), Aleph::Net_Cost_Graph< NodeT, ArcT >::emplace_arc(), Aleph::Net_Graph< NodeT, ArcT >::emplace_arc(), Aleph::generate_bipartite_network(), Aleph::generate_grid_network(), Aleph::generate_layered_network(), Aleph::generate_random_network(), Aleph::import_network_from_dimacs(), Aleph::Testing::RandomNetworkGenerator< Net >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Cost_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Cost_Graph< NodeT, ArcT >::insert_arc(), main(), Aleph::Net_Graph< NodeT, ArcT >::make_super_sink(), Aleph::Net_Graph< NodeT, ArcT >::make_super_source(), Aleph::segment_image(), AuxNetTest::SetUp(), Aleph::solve_assignment(), Aleph::solve_circulation(), Aleph::solve_project_selection(), Aleph::solve_transportation(), Aleph::solve_transshipment(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), test_graph(), and Aleph::vertex_connectivity().
|
inline |
Insert a new node with default info.
Definition at line 756 of file tpl_net.H.
References Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::insert_node(), and Aleph::Net_Graph< NodeT, ArcT >::register_node().
Referenced by Aleph::Net_Sup_Dem_Graph< NodeT, ArcT >::compute_aux_net(), Aleph::Net_Graph< NodeT, ArcT >::emplace_node(), Aleph::Net_Cap_Graph< NodeT, ArcT >::insert_node(), Aleph::Net_Sup_Dem_Graph< NodeT, ArcT >::insert_node(), Aleph::Net_Cap_Graph< NodeT, ArcT >::insert_node(), Aleph::Net_Graph< NodeT, ArcT >::make_super_sink(), and Aleph::Net_Graph< NodeT, ArcT >::make_super_source().
|
inline |
Allocate a new node, set by copy its data content and insert it into the graph.
This method perform several actions. First, it allocates memory for a graph node. Then the data node_info is copied to the data associated to the node. This copy is done via the copy constructor and assign operator. So, these functionalities must be present for the class Node_Type. Finally, the node is topologically inserted into the graph.
| [in] | node_info | info to copy to the new node. The copy constructor and the assign operator must be defined for the class Node_Type. |
| bad_allod | if there is no enough memory |
Definition at line 297 of file graph-dry.H.
|
inline |
Insert a new node by copying node_info.
| [in] | node_info | Info to copy into the node. |
| bad_alloc | If there is not enough memory. |
Definition at line 750 of file tpl_net.H.
References Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::insert_node(), and Aleph::Net_Graph< NodeT, ArcT >::register_node().
Referenced by add_super_source_and_sink(), build_antiparallel_network(), build_datacenter_network(), build_grid_network(), Aleph::build_residual_net(), build_simple_network(), build_supply_chain(), build_tenths_network(), build_water_network(), Aleph::check_baseball_elimination(), Aleph::Net_Cap_Graph< NodeT, ArcT >::compute_aux_net(), Aleph::compute_min_cut(), demo_dot_export(), demonstrate_bipartite_matching(), Aleph::design_survey(), Aleph::edge_connectivity(), Aleph::Testing::ErdosRenyiGenerator< Net >::generate(), Aleph::Testing::LayeredNetworkGenerator< Net >::generate(), Aleph::Testing::GridNetworkGenerator< Net >::generate(), Aleph::Testing::BipartiteNetworkGenerator< Net >::generate(), Aleph::generate_bipartite_network(), Aleph::generate_grid_network(), Aleph::generate_layered_network(), Aleph::generate_random_network(), Aleph::import_network_from_dimacs(), main(), Aleph::segment_image(), Aleph::solve_assignment(), Aleph::solve_circulation(), Aleph::solve_project_selection(), Aleph::solve_transportation(), Aleph::solve_transshipment(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and Aleph::vertex_connectivity().
|
inline |
Inserts the node p, made with new, which the graph takes.
| [in] | p | node without arcs that belongs to no graph. |
| bad_alloc | if the set of nodes cannot take p, which is then deleted, as List_SGraph::insert_node() and Net_Graph::insert_node() do: the methods that allocate the node and call this one do not free it. |
Definition at line 494 of file tpl_agraph.H.
|
inlineoverride |
Insert the node p, allocated by the caller.
| [in] | p | Node to insert. |
| bad_alloc | If there is not enough memory; then p is removed from the network and freed. |
Definition at line 781 of file tpl_net.H.
References Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::insert_node(), and Aleph::Net_Graph< NodeT, ArcT >::register_node().
|
inline |
Insert a new node by moving info.
Definition at line 762 of file tpl_net.H.
References Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::insert_node(), and Aleph::Net_Graph< NodeT, ArcT >::register_node().
|
inline |
Allocate a new node, set by moving its data content and insert it into the graph.
This method perform several actions. First, it allocates memory for a graph node. Then the data node_info is moved to the data associated to the node. This movement is done via the move constructor and move assign operator. So, these functionalities must be present for the class Node_Type. Finally, the node is topologically inserted into the graph.
| [in] | node_info | info to move to the new node. The move constructor and the move assign operator must be defined for the class Node_Type. |
| bad_allod | if there is no enough memory. |
Definition at line 297 of file graph-dry.H.
|
inlinenoexcept |
Return true if p is connected (used for validation).
Definition at line 441 of file tpl_net.H.
References Aleph::Net_Graph< NodeT, ArcT >::get_in_degree(), and Aleph::Net_Graph< NodeT, ArcT >::get_out_degree().
Referenced by Aleph::Net_Graph< NodeT, ArcT >::check_node().
|
inlineconstexprnoexcept |
Return true if the network has a single sink.
Definition at line 435 of file tpl_net.H.
References Aleph::Net_Graph< NodeT, ArcT >::sink_nodes, and Aleph::DynSetTree< Key, Tree, Compare >::size().
Referenced by Aleph::aumenting_path_maximum_flow(), Aleph::build_residual_net(), Aleph::capacity_scaling_maximum_flow(), Aleph::decompose_flow(), Aleph::dinic_maximum_flow(), Aleph::export_network_to_dimacs(), Aleph::export_network_to_dot(), Aleph::export_network_to_json(), Aleph::generic_preflow_vertex_push_maximum_flow(), Aleph::hlpp_maximum_flow(), Aleph::network_to_dot_string(), Aleph::network_to_json_string(), Aleph::successive_shortest_paths(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inlineconstexprnoexcept |
Return true if the network has a single source.
Definition at line 429 of file tpl_net.H.
References Aleph::DynSetTree< Key, Tree, Compare >::size(), and Aleph::Net_Graph< NodeT, ArcT >::src_nodes.
Referenced by Aleph::aumenting_path_maximum_flow(), Aleph::build_residual_net(), Aleph::capacity_scaling_maximum_flow(), Aleph::compute_flow_statistics(), Aleph::decompose_flow(), Aleph::dinic_maximum_flow(), Aleph::export_network_to_dimacs(), Aleph::export_network_to_dot(), Aleph::export_network_to_json(), Aleph::generic_preflow_vertex_push_maximum_flow(), Aleph::hlpp_maximum_flow(), Aleph::network_to_dot_string(), Aleph::network_to_json_string(), Aleph::successive_shortest_paths(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inlinenoexcept |
Return true if node is a sink.
Definition at line 423 of file tpl_net.H.
References Aleph::DynSetTree< Key, Tree, Compare >::contains(), and Aleph::Net_Graph< NodeT, ArcT >::sink_nodes.
Referenced by Aleph::Net_Graph< NodeT, ArcT >::check_node(), demonstrate_bipartite_matching(), print_network(), TEST(), TEST(), TEST(), and verify_flow_conservation().
|
inlinenoexcept |
Return true if node is a source.
Definition at line 417 of file tpl_net.H.
Referenced by Aleph::Net_Graph< NodeT, ArcT >::check_node(), demonstrate_bipartite_matching(), print_cost_network(), print_network(), TEST(), TEST(), TEST(), and verify_flow_conservation().
|
inline |
Convert a multi-source/multi-sink network into super-source/super-sink.
| domain_error | if the network has no source or no sink. |
| bad_alloc | if there is not enough memory. Then the network is as it was. |
Definition at line 709 of file tpl_net.H.
References Aleph::Net_Graph< NodeT, ArcT >::make_super_sink(), Aleph::Net_Graph< NodeT, ArcT >::make_super_source(), Aleph::Net_Graph< NodeT, ArcT >::unmake_super_source(), and Aleph::Net_Graph< NodeT, ArcT >::with_super_source.
|
inline |
Convert a multi-sink network into a single super-sink network.
Throws if there is no sink node or on allocation failure.
Definition at line 656 of file tpl_net.H.
References ah_domain_error_if, Aleph::DynList< T >::append(), Aleph::Net_Graph< NodeT, ArcT >::get_in_cap(), LocateFunctions< Container, Type >::get_it(), Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_node(), Aleph::Net_Graph< NodeT, ArcT >::remove_node(), Aleph::Net_Graph< NodeT, ArcT >::sink_nodes, Aleph::DynSetTree< Key, Tree, Compare >::size(), Aleph::Net_Graph< NodeT, ArcT >::super_sink_node, and Aleph::Net_Graph< NodeT, ArcT >::with_super_sink.
Referenced by Aleph::Net_Graph< NodeT, ArcT >::make_super_nodes(), Aleph::segment_image(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inline |
Convert a multi-source network into a single super-source network.
Throws if there is no source node or on allocation failure.
Definition at line 603 of file tpl_net.H.
References ah_domain_error_if, Aleph::DynList< T >::append(), LocateFunctions< Container, Type >::get_it(), Aleph::Net_Graph< NodeT, ArcT >::get_out_cap(), Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_node(), Aleph::Net_Graph< NodeT, ArcT >::remove_node(), Aleph::DynSetTree< Key, Tree, Compare >::size(), Aleph::Net_Graph< NodeT, ArcT >::src_nodes, Aleph::Net_Graph< NodeT, ArcT >::super_source_node, and Aleph::Net_Graph< NodeT, ArcT >::with_super_source.
Referenced by Aleph::Net_Graph< NodeT, ArcT >::make_super_nodes(), Aleph::segment_image(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inlinestaticnoexcept |
The tolerance of rounding of the flow of a node whose flows into and out of it are in and out.
For a floating flow, 1e-9 of the larger of them: the scale of the node is its own flows, so that a small flow next to a large capacity elsewhere keeps its precision. Zero for an integer flow.
Definition at line 453 of file tpl_net.H.
References out.
Referenced by Aleph::Net_Graph< NodeT, ArcT >::check_tolerance(), Aleph::decompose_flow(), Aleph::Network_Simplex< Net >::feasible_flow(), Aleph::Net_Sup_Dem_Graph< NodeT, ArcT >::filled(), Aleph::net_detail::not_short(), and Aleph::net_detail::return_dust().
|
inlineprivate |
Definition at line 524 of file tpl_net.H.
References Aleph::Net_Graph< NodeT, ArcT >::check_tolerance(), Aleph::Net_Graph< NodeT, ArcT >::get_in_flow(), Aleph::Net_Graph< NodeT, ArcT >::get_out_flow(), and Aleph::sum().
Referenced by Aleph::Net_Graph< NodeT, ArcT >::same_totals().
|
inline |
Copy-assign a network. Throws bad_alloc on allocation failure.
Definition at line 1059 of file tpl_net.H.
References GraphCommon< GT, Node, Arc >::get_cookie(), and Aleph::Net_Graph< NodeT, ArcT >::swap().
|
inlinenoexcept |
Move-assign a network. O(1) operation.
Definition at line 1051 of file tpl_net.H.
References Aleph::Net_Graph< NodeT, ArcT >::swap().
|
inlinenoexcept |
|
inlinenoexcept |
|
inlineprivate |
Definition at line 881 of file tpl_net.H.
References Aleph::and, Aleph::Net_Graph< NodeT, ArcT >::get_in_degree(), Aleph::Net_Graph< NodeT, ArcT >::get_out_degree(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::DynSetTree< Key, Tree, Compare >::remove(), Aleph::Net_Graph< NodeT, ArcT >::sink_nodes, and Aleph::Net_Graph< NodeT, ArcT >::src_nodes.
Referenced by Aleph::Net_Graph< NodeT, ArcT >::disconnect_arc(), and Aleph::Net_Graph< NodeT, ArcT >::remove_arc().
|
inlineprivate |
Insert p into source/sink sets with rollback on failure.
Definition at line 570 of file tpl_net.H.
References Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::DynSetTree< Key, Tree, Compare >::remove(), Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::remove_node(), Aleph::Net_Graph< NodeT, ArcT >::sink_nodes, and Aleph::Net_Graph< NodeT, ArcT >::src_nodes.
Referenced by Aleph::Net_Graph< NodeT, ArcT >::insert_node(), Aleph::Net_Graph< NodeT, ArcT >::insert_node(), Aleph::Net_Graph< NodeT, ArcT >::insert_node(), and Aleph::Net_Graph< NodeT, ArcT >::insert_node().
|
inlineoverride |
Remove arc arc from the network.
| bad_alloc | if the set of sources or that of sinks cannot take an end of the arc that becomes one. The network is then as it was. |
Definition at line 906 of file tpl_net.H.
References Aleph::Net_Graph< NodeT, ArcT >::register_ends_of_leaving(), and Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::remove_arc().
Referenced by Aleph::Net_Cap_Graph< NodeT, ArcT >::remove_arc(), TEST(), TEST(), and TEST_F().
|
inlineoverride |
Remove node p and all its arcs from the network.
| bad_alloc | as remove_arc(), for the arcs of p. Then the arcs that went are gone, p and the others are in the network, and the sets of sources and sinks are right. |
Definition at line 933 of file tpl_net.H.
References Aleph::DynSetTree< Key, Tree, Compare >::remove(), Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::remove_node(), Aleph::Net_Graph< NodeT, ArcT >::sink_nodes, Aleph::Net_Graph< NodeT, ArcT >::src_nodes, Aleph::Net_Graph< NodeT, ArcT >::super_sink_node, Aleph::Net_Graph< NodeT, ArcT >::super_source_node, Aleph::Net_Graph< NodeT, ArcT >::with_super_sink, and Aleph::Net_Graph< NodeT, ArcT >::with_super_source.
Referenced by Aleph::compute_min_cut(), Aleph::edge_connectivity(), Aleph::Net_Graph< NodeT, ArcT >::make_super_sink(), Aleph::Net_Graph< NodeT, ArcT >::make_super_source(), Aleph::Net_Sup_Dem_Graph< NodeT, ArcT >::remove_node(), Aleph::Net_Cap_Graph< NodeT, ArcT >::remove_node(), Aleph::solve_circulation(), Aleph::solve_transshipment(), TEST_F(), Aleph::Net_Graph< NodeT, ArcT >::unmake_super_sink(), and Aleph::Net_Graph< NodeT, ArcT >::unmake_super_source().
|
inline |
Reset all arc flows to zero.
Definition at line 1099 of file tpl_net.H.
Referenced by Aleph::compute_min_cut(), Aleph::edge_connectivity(), Random_Network_Flow< Net >::operator()(), and Aleph::vertex_connectivity().
|
inlineprivate |
Definition at line 538 of file tpl_net.H.
References Aleph::Net_Graph< NodeT, ArcT >::check_tolerance(), Aleph::diff(), Aleph::Net_Graph< NodeT, ArcT >::nodes_tolerance(), and out.
Referenced by Aleph::Net_Graph< NodeT, ArcT >::check_network(), and Aleph::Net_Graph< NodeT, ArcT >::flow_value().
|
inline |
Set the capacity of an arc.
Definition at line 1071 of file tpl_net.H.
References ah_out_of_range_error_if.
|
inline |
|
inlinenoexcept |
Swap contents with another network.
O(1) operation.
A network swapped with itself stays as it is, and is told nothing.
| [in,out] | other | Network to swap with. |
Definition at line 1032 of file tpl_net.H.
References Aleph::Net_Graph< NodeT, ArcT >::swap_contents(), and Aleph::Net_Graph< NodeT, ArcT >::swapped().
Referenced by Aleph::Net_Cost_Graph< NodeT, ArcT >::operator=(), Aleph::Net_Graph< NodeT, ArcT >::operator=(), Aleph::Net_Graph< NodeT, ArcT >::operator=(), TEST(), TEST(), TEST(), and TEST().
|
inlineprotectednoexcept |
Exchange the nodes, the arcs and the rest of the state of this network with those of other, as swap() does, without calling swapped().
O(1).
For the swap() of a derived network that exchanges too what it keeps for its nodes and arcs, which then goes with them.
| [in,out] | other | Network to exchange with. |
Definition at line 995 of file tpl_net.H.
References GraphCommon< GT, Node, Arc >::common_swap(), Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::get_arc_dlink(), Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::get_node_dlink(), Aleph::Net_Graph< NodeT, ArcT >::Infinity, Aleph::Net_Graph< NodeT, ArcT >::sink_nodes, Aleph::Net_Graph< NodeT, ArcT >::src_nodes, Aleph::Net_Graph< NodeT, ArcT >::super_sink_node, Aleph::Net_Graph< NodeT, ArcT >::super_source_node, Aleph::Dlink::swap(), Aleph::DynSetTree< Key, Tree, Compare >::swap(), Aleph::Net_Graph< NodeT, ArcT >::with_super_sink, and Aleph::Net_Graph< NodeT, ArcT >::with_super_source.
Referenced by Aleph::Net_Cap_Graph< NodeT, ArcT >::Net_Cap_Graph(), Aleph::Net_Graph< NodeT, ArcT >::Net_Graph(), Aleph::Net_Sup_Dem_Graph< NodeT, ArcT >::Net_Sup_Dem_Graph(), Aleph::Net_Cap_Graph< NodeT, ArcT >::operator=(), Aleph::Net_Cap_Graph< NodeT, ArcT >::swap(), Aleph::Net_Graph< NodeT, ArcT >::swap(), and Aleph::Net_Sup_Dem_Graph< NodeT, ArcT >::swap().
|
inlineprotectedvirtualnoexcept |
What swap() calls on each of its two networks, once their nodes and arcs are exchanged: nothing, in Net_Graph.
A derived network that keeps something for its nodes and arcs, as Net_Cap_Graph its auxiliary network, overrides it: a swap(), a move or an assignment through a reference to Net_Graph exchange the nodes and the arcs, and not what the derived network keeps for them.
Net_Cap_Graph and Net_Sup_Dem_Graph make it final, since what they do in it has to be done: a network derived from one of them is told of no exchange, neither through a reference to Net_Graph nor through one to its base, and must keep nothing for the nodes and the arcs that such an exchange would leave behind.
Reimplemented in Aleph::Net_Sup_Dem_Graph< NodeT, ArcT >, Aleph::Net_Sup_Dem_Graph< SimpleNode, SimpleArc >, Aleph::Net_Sup_Dem_Graph< StringNode, StringArc >, Aleph::Net_Cap_Graph< NodeT, ArcT >, Aleph::Net_Cap_Graph< DefaultNode, DefaultArc >, and Aleph::Net_Cap_Graph< IntNode, IntArc >.
Definition at line 1023 of file tpl_net.H.
Referenced by Aleph::Net_Graph< NodeT, ArcT >::swap().
|
inlineprivate |
Return total incoming flow to all sinks.
Definition at line 561 of file tpl_net.H.
References Aleph::Net_Graph< NodeT, ArcT >::get_in_flow(), LocateFunctions< Container, Type >::get_it(), Aleph::Net_Graph< NodeT, ArcT >::sink_nodes, and Aleph::sum().
Referenced by Aleph::Net_Graph< NodeT, ArcT >::check_network(), and Aleph::Net_Graph< NodeT, ArcT >::flow_value().
|
inlineprivate |
Return total outgoing flow from all sources.
Definition at line 552 of file tpl_net.H.
References LocateFunctions< Container, Type >::get_it(), Aleph::Net_Graph< NodeT, ArcT >::get_out_flow(), Aleph::Net_Graph< NodeT, ArcT >::src_nodes, and Aleph::sum().
Referenced by Aleph::Net_Graph< NodeT, ArcT >::check_network(), and Aleph::Net_Graph< NodeT, ArcT >::flow_value().
|
inline |
Restore a super-source/super-sink network to its original form.
Definition at line 726 of file tpl_net.H.
References Aleph::Net_Graph< NodeT, ArcT >::unmake_super_sink(), and Aleph::Net_Graph< NodeT, ArcT >::unmake_super_source().
|
inline |
Restore a super-sink network to its original multi-sink form, by removing the super sink that make_super_sink() inserted.
| bad_alloc | as unmake_super_source(); then another call goes on likewise. |
Definition at line 688 of file tpl_net.H.
References Aleph::Net_Graph< NodeT, ArcT >::remove_node(), Aleph::Net_Graph< NodeT, ArcT >::super_sink_node, and Aleph::Net_Graph< NodeT, ArcT >::with_super_sink.
Referenced by TEST(), and Aleph::Net_Graph< NodeT, ArcT >::unmake_super_nodes().
|
inline |
Restore a super-source network to its original multi-source form, by removing the super source that make_super_source() inserted.
| bad_alloc | as remove_node(), if a source cannot go back to the set of sources. Then the super-source stays, maybe with fewer arcs, and another call goes on: the network keeps the super source, which is then one of several sources, and never takes another for it. |
Definition at line 640 of file tpl_net.H.
References Aleph::Net_Graph< NodeT, ArcT >::remove_node(), Aleph::Net_Graph< NodeT, ArcT >::super_source_node, and Aleph::Net_Graph< NodeT, ArcT >::with_super_source.
Referenced by Aleph::Net_Graph< NodeT, ArcT >::make_super_nodes(), TEST(), and Aleph::Net_Graph< NodeT, ArcT >::unmake_super_nodes().
|
mutable |
Definition at line 336 of file tpl_net.H.
Referenced by Aleph::increase_flow(), and Aleph::Net_Graph< NodeT, ArcT >::swap_contents().
|
private |
Definition at line 499 of file tpl_net.H.
Referenced by Aleph::Net_Graph< NodeT, ArcT >::check_network(), Aleph::Net_Graph< NodeT, ArcT >::connect_arc(), Aleph::Net_Graph< NodeT, ArcT >::flow_value(), Aleph::Net_Graph< NodeT, ArcT >::get_sink(), Aleph::Net_Graph< NodeT, ArcT >::get_sink_nodes(), Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::is_single_sink(), Aleph::Net_Graph< NodeT, ArcT >::is_sink(), Aleph::Net_Graph< NodeT, ArcT >::make_super_sink(), Aleph::Net_Graph< NodeT, ArcT >::register_ends_of_leaving(), Aleph::Net_Graph< NodeT, ArcT >::register_node(), Aleph::Net_Graph< NodeT, ArcT >::remove_node(), Aleph::Net_Graph< NodeT, ArcT >::swap_contents(), and Aleph::Net_Graph< NodeT, ArcT >::total_sink_in_flow().
|
private |
Definition at line 498 of file tpl_net.H.
Referenced by Aleph::Net_Graph< NodeT, ArcT >::check_network(), Aleph::Net_Graph< NodeT, ArcT >::connect_arc(), Aleph::Net_Graph< NodeT, ArcT >::flow_value(), Aleph::Net_Graph< NodeT, ArcT >::get_source(), Aleph::Net_Graph< NodeT, ArcT >::get_src_nodes(), Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Sup_Dem_Graph< SimpleNode, SimpleArc >::insert_node(), Aleph::Net_Graph< NodeT, ArcT >::is_single_source(), Aleph::Net_Graph< NodeT, ArcT >::make_super_source(), Aleph::Net_Graph< NodeT, ArcT >::register_ends_of_leaving(), Aleph::Net_Graph< NodeT, ArcT >::register_node(), Aleph::Net_Graph< NodeT, ArcT >::remove_node(), Aleph::Net_Graph< NodeT, ArcT >::swap_contents(), and Aleph::Net_Graph< NodeT, ArcT >::total_source_out_flow().
|
private |
Definition at line 505 of file tpl_net.H.
Referenced by Aleph::Net_Graph< NodeT, ArcT >::Net_Graph(), Aleph::Net_Graph< NodeT, ArcT >::make_super_sink(), Aleph::Net_Graph< NodeT, ArcT >::remove_node(), Aleph::Net_Graph< NodeT, ArcT >::swap_contents(), and Aleph::Net_Graph< NodeT, ArcT >::unmake_super_sink().
|
private |
Definition at line 504 of file tpl_net.H.
Referenced by Aleph::Net_Graph< NodeT, ArcT >::Net_Graph(), Aleph::Net_Graph< NodeT, ArcT >::make_super_source(), Aleph::Net_Graph< NodeT, ArcT >::remove_node(), Aleph::Net_Graph< NodeT, ArcT >::swap_contents(), and Aleph::Net_Graph< NodeT, ArcT >::unmake_super_source().
| bool Aleph::Net_Graph< NodeT, ArcT >::with_super_sink |
True if the network has a super-sink.
Definition at line 1153 of file tpl_net.H.
Referenced by Aleph::Net_Graph< NodeT, ArcT >::make_super_sink(), Aleph::Net_Graph< NodeT, ArcT >::remove_node(), Aleph::Net_Graph< NodeT, ArcT >::swap_contents(), and Aleph::Net_Graph< NodeT, ArcT >::unmake_super_sink().
| bool Aleph::Net_Graph< NodeT, ArcT >::with_super_source |
True if the network has a super-source.
Definition at line 1150 of file tpl_net.H.
Referenced by Aleph::Net_Graph< NodeT, ArcT >::make_super_nodes(), Aleph::Net_Graph< NodeT, ArcT >::make_super_source(), Aleph::Net_Graph< NodeT, ArcT >::remove_node(), Aleph::Net_Graph< NodeT, ArcT >::swap_contents(), and Aleph::Net_Graph< NodeT, ArcT >::unmake_super_source().