27 # ifndef TPL_NETCAPGRAPH_H 28 # define TPL_NETCAPGRAPH_H 29 # include <tpl_netgraph.H> 40 template <
typename Node_Info,
typename F_Type =
double>
49 Net_Cap_Node() : max_cap(numeric_limits<Flow_Type>::max()) {}
54 :
Net_Node<Node_Info, F_Type>(node_info),
55 max_cap(numeric_limits<Flow_Type>::max())
61 :
Net_Node<Node_Info, F_Type>(*node), max_cap(node->max_cap) { }
87 template <
class NodeT,
class ArcT>
115 const Flow_Type & cap = numeric_limits<Flow_Type>::max())
117 Node * p = Net_Class::insert_node(node_info);
165 if (aux_net !=
nullptr)
166 throw std::domain_error(
"aux_net has already computed");
167 aux_net =
new Aux_Net;
170 for (Node_Iterator<Net_Cap_Graph> it(*
this); it.has_curr();
173 Node * p = it.get_curr_ne();
177 aux_net->
insert_arc(src, tgt,
true, p->max_cap, 0);
184 Arc * arc = it.get_curr_ne();
192 arc->cap, arc->flow);
219 if (aux_net ==
nullptr)
220 throw std::domain_error(
"Auxiliar net has not been generated");
222 for (
Arc_Iterator<Aux_Net, No_Res_Arc<Aux_Net> > it(*aux_net);
223 it.has_curr(); it.next_ne())
229 p->in_flow = p->out_flow = arc->flow;
242 if (aux_net ==
nullptr)
243 throw std::domain_error(
"Auxiliar net has not been generated");
252 if (aux_net !=
nullptr)
Node * insert_node(const Node_Type &node_info, const Flow_Type &cap=numeric_limits< Flow_Type >::max())
Definition: tpl_netcapgraph.H:114
void clear_graph(GT &g) noexcept
Definition: tpl_graph.H:3463
Definition: tpl_agraph.H:301
Net_Cap_Node(const Node_Info &node_info)
Definition: tpl_netcapgraph.H:53
#define NODE_COOKIE(p)
Definition: aleph-graph.H:333
Definition: tpl_netcapgraph.H:41
Definition: tpl_netcapgraph.H:88
void free_aux_net()
Definition: tpl_netcapgraph.H:240
F_Type Flow_Type
Tipo que representa el flujo.
Definition: tpl_netcapgraph.H:45
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())
Definition: tpl_net.H:575
Definition: tpl_net.H:216
ArcT Arc
Tipo de arco.
Definition: tpl_netcapgraph.H:94
Aux_Net * compute_aux_net()
Definition: tpl_netcapgraph.H:163
Net_Graph< NodeT, ArcT > Net_Class
La clase de red tradicional.
Definition: tpl_netcapgraph.H:92
#define ARC_COOKIE(p)
Definition: aleph-graph.H:366
Net_Graph< Net_Node< Empty_Class, Flow_Type >, Net_Arc< bool, Flow_Type > > Aux_Net
Definition: tpl_netcapgraph.H:142
Net_Cap_Node(Net_Cap_Node *node)
Definition: tpl_netcapgraph.H:60
void update()
Definition: tpl_netcapgraph.H:217
Node::Node_Type Node_Type
Tipo de atributo que almacena un nodo.
Definition: tpl_netcapgraph.H:100
NodeT Node
Tipo de node.
Definition: tpl_net.H:230
Definition: tpl_agraph.H:43
Arc::Flow_Type Flow_Type
Tipo que representa la capacidad y el flujo.
Definition: tpl_netcapgraph.H:98
ArcT Arc
Tipo de arco.
Definition: tpl_net.H:227
NodeInfo Node_Type
The node.
Definition: graph-dry.H:233
NodeT Node
Tipo de node.
Definition: tpl_netcapgraph.H:96
Node * get_src_node(Arc *arc) const noexcept
Return the source node of arc (only for directed graphs)
Definition: graph-dry.H:447
Node * insert_node(const Node_Type &node_info)
Definition: tpl_net.H:481
Node * get_tgt_node(Arc *arc) const noexcept
Return the target node of arc (only for directed graphs)
Definition: graph-dry.H:453
Aux_Net * get_aux_net()
Definition: tpl_netcapgraph.H:149
Arc::Arc_Type Arc_Type
Tipo de atributo que almacena un arco.
Definition: tpl_netcapgraph.H:102