Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Net_Graph< NodeT, ArcT > Struct Template Reference

Flow network implemented with adjacency lists. More...

#include <tpl_net.H>

Inheritance diagram for Aleph::Net_Graph< NodeT, ArcT >:
[legend]
Collaboration diagram for Aleph::Net_Graph< NodeT, ArcT >:
[legend]

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 () noexcept
 Restore a super-source network to its original multi-source form.
 
void make_super_sink ()
 Convert a multi-sink network into a single super-sink network.
 
void unmake_super_sink () noexcept
 Restore a super-sink network to its original multi-sink form.
 
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.
 
Nodeget_source () const
 Return an arbitrary source node.
 
Nodeget_sink () const
 Return an arbitrary sink node.
 
Nodeinsert_node (const Node_Type &node_info)
 Insert a new node by copying node_info.
 
Nodeinsert_node ()
 Insert a new node with default info.
 
Nodeinsert_node (Node_Type &&info)
 Insert a new node by moving info.
 
template<typename... Args>
Nodeemplace_node (Args &&... args)
 Construct a node in-place and insert it into the network.
 
Nodeinsert_node (Node *p)
 Insert a node by copying another node.
 
Arcinsert_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>
Arcemplace_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.
 
Arcconnect_arc (Arc *arc)
 Connect a previously disconnected arc.
 
Arcinsert_arc (Node *src_node, Node *tgt_node, const Flow_Type &cap)
 Insert an arc with capacity cap and zero flow.
 
template<typename T = Arc_Type, typename = std::enable_if_t<!std::is_same<T, Flow_Type>::value && !std::is_arithmetic_v<T>>>
Arcinsert_arc (Node *src_node, Node *tgt_node, const T &arc_info=Arc_Type())
 Insert an arc with zero capacity and flow.
 
void remove_arc (Arc *arc) override
 Remove arc arc from the network.
 
void disconnect_arc (Arc *arc) noexcept
 Disconnect arc arc from the graph without deleting it.
 
void remove_node (Node *p) noexcept 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. O(1) operation.
 
 Net_Graph (Net_Graph &&other) noexcept
 Move-construct a network. O(1) operation.
 
Net_Graphoperator= (Net_Graph &&other) noexcept
 Move-assign a network. O(1) operation.
 
Net_Graphoperator= (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_Typeget_flow (Arc *arc) const noexcept
 Return the flow value of an arc.
 
const Flow_Typeget_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.
 
 Net_Graph ()
 Default constructor.
 
virtual Nodeinsert_node (Node *p)
 
Nodeinsert_node (const Node_Type &node_info)
 Allocate a new node, set by copy its data content and insert it into the graph.
 
Nodeinsert_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 >
Dlinkget_node_dlink () noexcept
 Returns reference to internal node Dlink for sorting operations.
 
Dlinkget_arc_dlink () noexcept
 Returns reference to internal arc Dlink for sorting operations.
 
virtual Nodeinsert_node (Node *p)
 
void compress ()
 
Arcconnect_arc (Arc *arc)
 
Arcdisconnect_arc (Arc *arc)
 
virtual void remove_arc (Arc *a)
 
virtual void remove_node (Node *p)
 
Nodeget_first_node () const
 
Arcget_first_arc () const
 
Arcget_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_Graphoperator= (const Array_Graph &g)
 Copy assignment.
 
Array_Graphoperator= (Array_Graph &&g) noexcept
 Move assignment.
 
Nodeinsert_node (const Node_Type &node_info)
 Allocate a new node, set by copy its data content and insert it into the graph.
 
Nodeinsert_node (Node_Type &&node_info=Node_Type())
 Allocate a new node, set by moving its data content and insert it into the graph.
 
Arcinsert_arc (Node *src, Node *tgt, const Arc_Type &arc_info)
 Create and insert a new arc linking two nodes and copying data.
 
Arcinsert_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 size_t vsize () const noexcept
 
Nodeget_node () const
 Return any node in the graph.
 
Nodeget_arc () const
 Return any arc in the graph.
 
Nodeget_arc (Node *p)
 Return any arc adjacent to a node.
 
Nodeget_src_node (Arc *arc) const noexcept
 Return the source node of arc (only for directed graphs)
 
Nodeget_tgt_node (Arc *arc) const noexcept
 Return the target node of arc (only for directed graphs)
 
Nodeget_connected_node (Arc *arc, Node *node) const noexcept
 Return the adjacent node to node through arc.
 
constexpr size_t get_num_arcs () const noexcept
 
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.
 
Nodeinsert_node (const Node_Type &node_info)
 Allocate a new node, set by copy its data content and insert it into the graph.
 
Nodeinsert_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>
Nodeemplace_node (Args &&... args)
 Insert a new node in the graph by constructing it in-place with the given args.
 
Arcinsert_arc (Node *src, Node *tgt, const Arc_Type &arc_info)
 Create and insert a new arc linking two nodes and copying data.
 
Arcinsert_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>
Arcemplace_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 >
bool traverse_nodes (Operation &op) const
 Conditioned traversal of all the nodes of a graph.
 
template<class Operation >
bool traverse_nodes (Operation &&op=Operation()) const
 Overload of traverse_nodes(Operation&) that accepts rvalues.
 
template<class Operation >
bool traverse_arcs (Operation &op) const
 Conditioned traversal of all the arcs of a graph.
 
template<class Operation >
bool traverse_arcs (Operation &&op=Operation()) const
 Overload of traverse_arcs(Operation&) that accepts rvalues.
 
template<class Operation >
bool traverse_arcs (Node *p, Operation &op) const
 Conditioned traversal of all the adjacent arcs of a node.
 
template<class Operation >
bool traverse_arcs (Node *p, Operation &&op=Operation()) const
 Overload of traverse_arcs(Node*, Operation&) that accepts rvalues.
 
template<class Operation >
void for_each_node (Operation &operation) const
 Unconditionally traverse all the nodes of graph and on each one perform an operation.
 
template<class Operation >
void for_each_node (Operation &&operation=Operation()) const
 Overload of for_each_node(Operation&) that accepts rvalues.
 
template<class Operation >
void for_each_arc (Operation &op) const
 Unconditionally traverse all the arcs of graph and on each one perform an operation.
 
template<class Operation >
void for_each_arc (Operation &&operation=Operation()) const
 Overload of for_each_arc(Operation&) that accepts rvalues.
 
template<class Operation >
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 >
void for_each_arc (Node *p, Operation &&op=Operation()) const
 Overload of for_each_arc(Node*, Operation&) that accepts rvalues.
 
template<class Operation >
bool all_nodes (Operation &op) const
 Check if all the nodes of graph satisfy an boolean condition.
 
template<class Operation >
bool all_nodes (Operation &&op=Operation()) const
 Overload of all_nodes(Operation&) that accepts rvalues.
 
template<class Operation >
bool all_arcs (Operation &op) const
 Check if all the arcs of graph satisfy a boolean condition.
 
template<class Operation >
bool all_arcs (Operation &&op=Operation()) const
 Overload of all_arcs(Operation&) that accepts rvalues.
 
template<class Operation >
bool all_arcs (Node *p, Operation &op) const
 Check if all the arcs adjacent to a node satisfy an boolean condition.
 
template<class Operation >
bool all_arcs (Node *p, Operation &&op=Operation()) const
 Overload of all_arcs(Node*, Operation&) that accepts rvalues.
 
template<typename T = Node_Type>
auto nodes_map (std::function< T(Node *)> op) const
 Map the nodes of a graph to a specific range.
 
template<typename T = Arc_Type>
auto arcs_map (std::function< T(Arc *)> operation) const
 Map the arcs of a graph to a specific range.
 
template<typename T = Arc_Type>
auto arcs_map (Node *p, std::function< T(Arc *)> operation) const
 Map the adjacent arcs of a node to a specific range.
 
template<typename T = Node_Type>
foldl_nodes (const T &init, std::function< T(const T &, Node *)> op) const
 Folding of nodes on a graph.
 
template<typename T = Arc_Type>
foldl_arcs (const T &init, std::function< T(const T &, Arc *)> op) const
 Folding of arcs on a graph.
 
template<typename T = Arc_Type>
foldl_arcs (Node *p, const T &init, std::function< T(const T &, Arc *)> op) const
 Folding of arcs of a node.
 
template<class Op >
auto filter_nodes (Op &op) const
 Filter the nodes satisfying a condition.
 
template<class Op >
auto filter_nodes (Op &&op) const
 Overload of filter_nodes(Op&) that accepts rvalues.
 
template<class Op >
auto filter_arcs (Op &op) const
 Filter the arcs of graph satisfying a condition.
 
template<class Op >
auto filter_arcs (Op &&op) const
 Overload of filter_arcs(Op&) that accepts rvalues.
 
template<class Op >
auto filter_arcs (Node *p, Op &op) const
 Filter the arcs adjacent to a node satisfying a condition.
 
template<class Op >
auto filter_arcs (Node *p, Op &&op) const
 Overload of filter_arcs(Node*, Op&) that accepts rvalues.
 
template<class Operation >
bool exists_node (Operation &op) const
 Determine if exists at least a node satisfying a condition.
 
template<class Operation >
bool exists_node (Operation &&op=Operation()) const
 Overload of exists_node(Operation&) that accepts rvalues.
 
template<class Operation >
bool exists_arc (Operation &op) const
 Determine if exists at least a arc satisfying a condition.
 
template<class Operation >
bool exists_arc (Operation &&op=Operation()) const
 Overload of exists_arc(Operation&) that accepts rvalues.
 
template<class Operation >
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 >
bool exists_arc (Node *p, Operation &&op=Operation()) const
 Overload of exists_arc(Node*, Operation&) that accepts rvalues.
 
template<class Operation >
bool none_node (Operation &op) const
 Determine if no node satisfies a condition.
 
template<class Operation >
bool none_node (Operation &&op) const
 Overload of none_node(Operation&) that accepts rvalues.
 
template<class Operation >
bool none_arc (Operation &op) const
 Determine if no arc satisfies a condition.
 
template<class Operation >
bool none_arc (Operation &&op) const
 Overload of none_arc(Operation&) that accepts rvalues.
 
template<class Operation >
bool none_arc (Node *p, Operation &op) const
 Determine if no arc adjacent to a node satisfies a condition.
 
template<class Operation >
bool none_arc (Node *p, Operation &&op) const
 Overload of none_arc(Node*, Operation&) that accepts rvalues.
 
template<class Operation = std::function<bool(Node*)>>
size_t count_nodes (Operation op=[](Node *) { return true;}) const
 Count the nodes satisfying a condition.
 
template<class Operation = std::function<bool(Arc*)>>
size_t count_arcs (Operation op=[](Arc *) { return true;}) const
 Count the arcs satisfying a condition.
 
template<class Operation = std::function<bool(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 >
sum_arcs (Node *p, Extract extract) const
 Sum values derived from arcs adjacent to a node.
 
template<typename T = double>
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*)>>
Arcmin_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*)>>
Arcmax_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*)>>
Arcmin_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*)>>
Arcmax_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 >
std::pair< DynList< Node * >, DynList< Node * > > partition_nodes (Operation op) const
 Partition nodes into two groups based on a predicate.
 
template<class Operation >
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 >
Nodesearch_node (Op &op) const
 Linear search of a node.
 
template<class Op >
Nodesearch_node (Op &&op) const
 Overload of search_node(Op&) that accepts rvalues.
 
Nodefind_node (const Node_Type &info) const noexcept
 Find a node mathing a content.
 
template<class Op >
Arcsearch_arc (Op &op) const
 Linear search of an arc.
 
template<class Op >
Arcsearch_arc (Op &&op) const
 Overload of search_arc(Op&) that accepts rvalues.
 
Arcfind_arc (const Arc_Type &info) const noexcept
 Find an arc mathing a content.
 
template<class Operation >
Arcsearch_arc (Node *p, Operation &op) const
 Linear search of an arc.
 
template<class Operation >
Arcsearch_arc (Node *p, Operation &&op=Operation()) const
 Overload of search_arc(Node*, Operation&) that accepts rvalues.
 
Arcsearch_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 noexcept
 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
 
Arcsearch_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 >
bool traverse_arcs (Node *p, Operation &op) const
 Traverse of arcs of a node according to specific arcs iterator.
 
template<class Itor , class Operation >
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
 
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 >
auto in_arcs_map (Node *p, std::function< T(Arc *)> 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>
foldl_in_arcs (Node *p, const T &init, std::function< T(const T &, Arc *)> 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>
auto out_arcs_map (Node *p, std::function< T(Arc *)> 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>
foldl_out_arcs (Node *p, const T &init, std::function< T(const T &, Arc *)> 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
 
template<class Compare >
requires (has_node_dlink_v<GT>)
void sort_nodes (Compare &&cmp=Compare()) noexcept
 
template<class Compare >
requires (has_arc_dlink_v<GT>)
void sort_arcs (Compare &cmp) noexcept
 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
 

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.
 

Private Member Functions

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.
 
Noderegister_node (Node *p)
 Insert p into source/sink sets with rollback on failure.
 

Private Attributes

DynSetTree< Node * > src_nodes
 
DynSetTree< Node * > sink_nodes
 

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 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.
 
- Static Public Attributes inherited from GraphCommon< GT, Node, Arc >
template<class U >
static constexpr bool has_node_dlink_v
 Sort all the nodes of the graph according to a specific criteria.
 
template<class U >
static constexpr bool has_arc_dlink_v
 
- 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.
 
- Protected Attributes inherited from GraphCommon< GT, Node, Arc >
void * cookie = nullptr
 
size_t num_nodes = 0
 
size_t num_arcs = 0
 
bool digraph = false
 

Detailed Description

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
struct Aleph::Net_Graph< NodeT, ArcT >

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:

  • NodeT: node type (must derive from Net_Node).
  • ArcT: arc type (must derive from Net_Arc).

Definition at line 260 of file tpl_net.H.

Member Typedef Documentation

◆ Arc

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
using Aleph::Net_Graph< NodeT, ArcT >::Arc = ArcT

Arc type.

Definition at line 272 of file tpl_net.H.

◆ Arc_Type

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
using Aleph::Net_Graph< NodeT, ArcT >::Arc_Type = typename Arc::Arc_Type

Arc info type.

Definition at line 284 of file tpl_net.H.

◆ Base

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
using Aleph::Net_Graph< NodeT, ArcT >::Base = Array_Graph<NodeT, ArcT>

Definition at line 264 of file tpl_net.H.

◆ Flow_Type

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
using Aleph::Net_Graph< NodeT, ArcT >::Flow_Type = typename Arc::Flow_Type

Capacity/flow numeric type.

Definition at line 278 of file tpl_net.H.

◆ Graph

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
using Aleph::Net_Graph< NodeT, ArcT >::Graph = Base

Definition at line 269 of file tpl_net.H.

◆ Net

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
using Aleph::Net_Graph< NodeT, ArcT >::Net = Net_Graph<NodeT, ArcT>

Definition at line 262 of file tpl_net.H.

◆ Node

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
using Aleph::Net_Graph< NodeT, ArcT >::Node = NodeT

Node type.

Definition at line 275 of file tpl_net.H.

◆ Node_Type

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
using Aleph::Net_Graph< NodeT, ArcT >::Node_Type = typename Node::Node_Type

Node info type.

Definition at line 281 of file tpl_net.H.

Constructor & Destructor Documentation

◆ Net_Graph() [1/3]

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
Aleph::Net_Graph< NodeT, ArcT >::Net_Graph ( const Net_Graph< NodeT, ArcT > &  net)
inline

Copy-construct a network. Throws bad_alloc on allocation failure.

Definition at line 713 of file tpl_net.H.

References GraphCommon< GT, Node, Arc >::arcs(), Aleph::copy_graph(), Aleph::maps(), and Aleph::zip().

◆ Net_Graph() [2/3]

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
Aleph::Net_Graph< NodeT, ArcT >::Net_Graph ( Net_Graph< NodeT, ArcT > &&  other)
inlinenoexcept

Move-construct a network. O(1) operation.

Definition at line 745 of file tpl_net.H.

References Aleph::maps(), and Aleph::Net_Graph< NodeT, ArcT >::swap().

◆ Net_Graph() [3/3]

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
Aleph::Net_Graph< NodeT, ArcT >::Net_Graph ( )
inline

Default constructor.

Definition at line 842 of file tpl_net.H.

Member Function Documentation

◆ check_network()

◆ check_node()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
bool Aleph::Net_Graph< NodeT, ArcT >::check_node ( Node node) const
inlinenoexcept

◆ connect_arc()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
Arc * Aleph::Net_Graph< NodeT, ArcT >::connect_arc ( Arc arc)
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).

Parameters
[in]arcArc to connect.
Returns
Pointer to the connected arc.

Definition at line 641 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(), and Aleph::vertex_connectivity().

◆ disconnect_arc()

◆ emplace_arc()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
template<typename... Args>
Arc * Aleph::Net_Graph< NodeT, ArcT >::emplace_arc ( Node src_node,
Node tgt_node,
const Flow_Type cap,
const Flow_Type flow,
Args &&...  args 
)
inline

Construct arc info in-place and insert the arc.

Definition at line 626 of file tpl_net.H.

References Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), and Aleph::maps().

◆ emplace_node()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
template<typename... Args>
Node * Aleph::Net_Graph< NodeT, ArcT >::emplace_node ( Args &&...  args)
inline

Construct a node in-place and insert it into the network.

Definition at line 578 of file tpl_net.H.

References Aleph::Net_Graph< NodeT, ArcT >::insert_node(), and Aleph::maps().

◆ flow_value()

◆ get_cap()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
const Flow_Type & Aleph::Net_Graph< NodeT, ArcT >::get_cap ( Arc arc) const
inlinenoexcept

Return the capacity value of an arc.

Definition at line 791 of file tpl_net.H.

◆ get_flow()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
const Flow_Type & Aleph::Net_Graph< NodeT, ArcT >::get_flow ( Arc arc) const
inlinenoexcept

Return the flow value of an arc.

Definition at line 788 of file tpl_net.H.

◆ get_in_cap()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
Flow_Type Aleph::Net_Graph< NodeT, ArcT >::get_in_cap ( Node node) const
inlinenoexcept

Return total incoming capacity of node.

Definition at line 315 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().

◆ get_in_degree()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
size_t Aleph::Net_Graph< NodeT, ArcT >::get_in_degree ( Node p) const
inlinenoexcept

◆ get_in_flow()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
Flow_Type Aleph::Net_Graph< NodeT, ArcT >::get_in_flow ( Node node) const
inlinenoexcept

◆ get_out_cap()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
Flow_Type Aleph::Net_Graph< NodeT, ArcT >::get_out_cap ( Node node) const
inlinenoexcept

Return total outgoing capacity of node.

Definition at line 324 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().

◆ get_out_degree()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
size_t Aleph::Net_Graph< NodeT, ArcT >::get_out_degree ( Node p) const
inlinenoexcept

◆ get_out_flow()

◆ get_sink()

◆ get_sink_nodes()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
const DynSetTree< Node * > & Aleph::Net_Graph< NodeT, ArcT >::get_sink_nodes ( ) const
inlinenoexcept

Return the set of sink nodes.

Definition at line 450 of file tpl_net.H.

References Aleph::Net_Graph< NodeT, ArcT >::sink_nodes.

Referenced by TEST(), and TEST().

◆ get_source()

◆ get_src_nodes()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
const DynSetTree< Node * > & Aleph::Net_Graph< NodeT, ArcT >::get_src_nodes ( ) const
inlinenoexcept

Return the set of source nodes.

Definition at line 447 of file tpl_net.H.

References Aleph::Net_Graph< NodeT, ArcT >::src_nodes.

Referenced by TEST().

◆ in_arcs()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
DynList< Arc * > Aleph::Net_Graph< NodeT, ArcT >::in_arcs ( Node p) const
inlinenoexcept

Return arcs incoming to p (as a DynList).

Definition at line 302 of file tpl_net.H.

References Aleph::maps().

◆ in_nodes()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
DynList< Node * > Aleph::Net_Graph< NodeT, ArcT >::in_nodes ( Node p) const
inlinenoexcept

Return nodes that can reach p through incoming arcs.

Definition at line 308 of file tpl_net.H.

References Aleph::maps().

◆ insert_arc() [1/3]

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
Arc * Aleph::Net_Graph< NodeT, ArcT >::insert_arc ( Node src_node,
Node tgt_node,
const Flow_Type cap 
)
inline

Insert an arc with capacity cap and zero flow.

Definition at line 655 of file tpl_net.H.

References Aleph::Net_Graph< NodeT, ArcT >::insert_arc().

◆ insert_arc() [2/3]

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
Arc * Aleph::Net_Graph< NodeT, ArcT >::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() 
)
inline

Insert a capacitated arc with an initial flow.

Parameters
[in]src_nodeSource node.
[in]tgt_nodeTarget node.
[in]capCapacity value.
[in]flowFlow value.
[in]arc_infoArc info to store.
Returns
Pointer to the inserted arc.
Exceptions
bad_allocIf there is not enough memory.
overflow_errorIf flow exceeds cap.

Definition at line 607 of file tpl_net.H.

References ah_overflow_error_if, Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::insert_arc(), Aleph::maps(), 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_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_Cost_Graph< NodeT, ArcT >::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 >::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_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(), and Aleph::vertex_connectivity().

◆ insert_arc() [3/3]

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
template<typename T = Arc_Type, typename = std::enable_if_t<!std::is_same<T, Flow_Type>::value && !std::is_arithmetic_v<T>>>
Arc * Aleph::Net_Graph< NodeT, ArcT >::insert_arc ( Node src_node,
Node tgt_node,
const T arc_info = Arc_Type() 
)
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 670 of file tpl_net.H.

References Aleph::Net_Graph< NodeT, ArcT >::insert_arc().

◆ insert_node() [1/7]

◆ insert_node() [2/7]

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
Node * GraphCommon< GT, Node, Arc >::insert_node ( const Node_Type node_info)
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.

Remarks
If this method does not throw exception, then this always returns a valid pointer,
Parameters
[in]node_infoinfo to copy to the new node. The copy constructor and the assign operator must be defined for the class Node_Type.
Returns
a pointer to the new inserted node.
Exceptions
bad_allodif there is no enough memory

Definition at line 288 of file graph-dry.H.

◆ insert_node() [3/7]

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
Node * Aleph::Net_Graph< NodeT, ArcT >::insert_node ( const Node_Type node_info)
inline

Insert a new node by copying node_info.

Parameters
[in]node_infoInfo to copy into the node.
Returns
Pointer to the inserted node.
Exceptions
bad_allocIf there is not enough memory.

Definition at line 559 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(), build_simple_network(), build_supply_chain(), 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(), 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_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().

◆ insert_node() [4/7]

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
virtual Node * Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::insert_node ( Node p)
inline

Definition at line 393 of file tpl_agraph.H.

◆ insert_node() [5/7]

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
Node * Aleph::Net_Graph< NodeT, ArcT >::insert_node ( Node p)
inline

Insert a node by copying another node.

Parameters
[in]pNode to copy.
Returns
Pointer to the inserted node.
Exceptions
bad_allocIf there is not enough memory.

Definition at line 590 of file tpl_net.H.

References Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::insert_node(), and Aleph::Net_Graph< NodeT, ArcT >::register_node().

◆ insert_node() [6/7]

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
Node * Aleph::Net_Graph< NodeT, ArcT >::insert_node ( Node_Type &&  info)
inline

◆ insert_node() [7/7]

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
Node * GraphCommon< GT, Node, Arc >::insert_node ( Node_Type &&  node_info = Node_Type())
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.

Remarks
If this method does not throw exception, then this always returns a valid pointer,
Parameters
[in]node_infoinfo to move to the new node. The move constructor and the move assign operator must be defined for the class Node_Type.
Returns
a pointer to the new inserted node.
Exceptions
bad_allodif there is no enough memory.

Definition at line 288 of file graph-dry.H.

◆ is_connected()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
bool Aleph::Net_Graph< NodeT, ArcT >::is_connected ( Node p) const
inlinenoexcept

Return true if p is connected (used for validation).

Definition at line 375 of file tpl_net.H.

References Aleph::Net_Graph< NodeT, ArcT >::get_in_degree(), Aleph::Net_Graph< NodeT, ArcT >::get_out_degree(), and Aleph::maps().

Referenced by Aleph::Net_Graph< NodeT, ArcT >::check_node().

◆ is_single_sink()

◆ is_single_source()

◆ is_sink()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
bool Aleph::Net_Graph< NodeT, ArcT >::is_sink ( Node node) const
inlinenoexcept

◆ is_source()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
bool Aleph::Net_Graph< NodeT, ArcT >::is_source ( Node node) const
inlinenoexcept

◆ make_super_nodes()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
void Aleph::Net_Graph< NodeT, ArcT >::make_super_nodes ( )
inline

Convert a multi-source/multi-sink network into super-source/super-sink.

Definition at line 526 of file tpl_net.H.

References Aleph::Net_Graph< NodeT, ArcT >::make_super_sink(), Aleph::Net_Graph< NodeT, ArcT >::make_super_source(), and Aleph::Net_Graph< NodeT, ArcT >::unmake_super_source().

◆ make_super_sink()

◆ make_super_source()

◆ operator=() [1/2]

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
Net_Graph & Aleph::Net_Graph< NodeT, ArcT >::operator= ( const Net_Graph< NodeT, ArcT > &  net)
inline

Copy-assign a network. Throws bad_alloc on allocation failure.

Definition at line 761 of file tpl_net.H.

References Aleph::maps(), and Aleph::Net_Graph< NodeT, ArcT >::swap().

◆ operator=() [2/2]

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
Net_Graph & Aleph::Net_Graph< NodeT, ArcT >::operator= ( Net_Graph< NodeT, ArcT > &&  other)
inlinenoexcept

Move-assign a network. O(1) operation.

Definition at line 753 of file tpl_net.H.

References Aleph::maps(), and Aleph::Net_Graph< NodeT, ArcT >::swap().

Referenced by Aleph::Net_Cap_Graph< NodeT, ArcT >::operator=(), and Aleph::Net_Cap_Graph< NodeT, ArcT >::operator=().

◆ out_arcs()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
DynList< Arc * > Aleph::Net_Graph< NodeT, ArcT >::out_arcs ( Node p) const
inlinenoexcept

Return arcs outgoing from p (as a DynList).

Definition at line 289 of file tpl_net.H.

References Aleph::maps().

◆ out_nodes()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
DynList< Node * > Aleph::Net_Graph< NodeT, ArcT >::out_nodes ( Node p) const
inlinenoexcept

Return nodes reachable from p through outgoing arcs.

Definition at line 295 of file tpl_net.H.

References Aleph::maps().

◆ register_node()

◆ remove_arc()

◆ remove_node()

◆ reset()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
void Aleph::Net_Graph< NodeT, ArcT >::reset ( )
inline

◆ set_cap()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
void Aleph::Net_Graph< NodeT, ArcT >::set_cap ( Arc arc,
const Flow_Type cap 
)
inline

Set the capacity of an arc.

Definition at line 772 of file tpl_net.H.

References ah_out_of_range_error_if, and Aleph::maps().

◆ set_flow()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
void Aleph::Net_Graph< NodeT, ArcT >::set_flow ( Arc arc,
const Flow_Type flow 
)
inline

Set the flow of an arc. Throws if flow exceeds capacity.

Definition at line 780 of file tpl_net.H.

References ah_out_of_range_error_if.

Referenced by TEST_F().

◆ swap()

◆ total_sink_in_flow()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
Flow_Type Aleph::Net_Graph< NodeT, ArcT >::total_sink_in_flow ( ) const
inlineprivate

◆ total_source_out_flow()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
Flow_Type Aleph::Net_Graph< NodeT, ArcT >::total_source_out_flow ( ) const
inlineprivate

◆ unmake_super_nodes()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
void Aleph::Net_Graph< NodeT, ArcT >::unmake_super_nodes ( )
inline

Restore a super-source/super-sink network to its original form.

Definition at line 541 of file tpl_net.H.

References Aleph::Net_Graph< NodeT, ArcT >::unmake_super_sink(), and Aleph::Net_Graph< NodeT, ArcT >::unmake_super_source().

◆ unmake_super_sink()

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
void Aleph::Net_Graph< NodeT, ArcT >::unmake_super_sink ( )
inlinenoexcept

◆ unmake_super_source()

Friends And Related Symbol Documentation

◆ operator<<

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
std::ostream & operator<< ( std::ostream &  s,
const Path< Net_Graph< NodeT, ArcT > > &  path 
)
friend

Stream a path with arc (cap,flow) tuples.

Definition at line 849 of file tpl_net.H.

Member Data Documentation

◆ Infinity

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
Flow_Type Aleph::Net_Graph< NodeT, ArcT >::Infinity
mutable

Definition at line 286 of file tpl_net.H.

Referenced by Aleph::increase_flow(), and Aleph::Net_Graph< NodeT, ArcT >::swap().

◆ sink_nodes

◆ src_nodes

◆ with_super_sink

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
bool Aleph::Net_Graph< NodeT, ArcT >::with_super_sink

◆ with_super_source

template<class NodeT = Net_Node<Empty_Class>, class ArcT = Net_Arc<Empty_Class, double>>
bool Aleph::Net_Graph< NodeT, ArcT >::with_super_source

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