Analysis Software
Documentation for sPHENIX simulation software
|
Maximum flow algorithm (Edmonds-Karp). More...
#include <JETSCAPE/blob/main/external_packages/gtl/include/GTL/maxflow_ff.h>
Public Member Functions | |
maxflow_ff () | |
virtual | ~maxflow_ff () |
void | set_vars (const edge_map< double > &edge_capacity) |
void | set_vars (const edge_map< double > &edge_capacity, const node &net_source, const node &net_target) |
virtual int | check (graph &G) |
int | run (graph &G) |
double | get_max_flow (const edge &e) const |
double | get_max_flow () const |
double | get_rem_cap (const edge &e) const |
virtual void | reset () |
Public Member Functions inherited from algorithm | |
algorithm () | |
Creates an algorithm object. | |
virtual | ~algorithm () |
Destroys the algorithm object. | |
Protected Types | |
enum | { SP_FOUND = 2, NO_SP_FOUND = 3 } |
Protected Member Functions | |
void | create_artif_source_target (graph &G) |
void | prepare_run (const graph &G) |
void | comp_single_flow (graph &G, node_map< edge > &last_edge) |
int | get_sp (const graph &G, node_map< edge > &last_edge) |
int | comp_sp (const graph &G, queue< node > &next_nodes, node_map< bool > &visited, node_map< edge > &last_edge) |
double | extra_charge (const node_map< edge > &last_edge) const |
void | create_back_edge (graph &G, const edge &org_edge) |
void | comp_max_flow (const graph &G) |
void | restore_graph (graph &G) |
Protected Attributes | |
bool | artif_source_target |
bool | set_vars_executed |
double | max_graph_flow |
node | net_source |
node | net_target |
list< edge > | edges_not_org |
edge_map< bool > | edge_org |
edge_map< bool > | back_edge_exists |
edge_map< edge > | back_edge |
edge_map< double > | edge_capacity |
edge_map< double > | edge_max_flow |
Additional Inherited Members | |
Public Types inherited from algorithm | |
enum | { GTL_OK = 1, GTL_ERROR = 0 } |
Return values for algorithm::check and algorithm::run. More... | |
Maximum flow algorithm (Edmonds-Karp).
Definition at line 25 of file maxflow_ff.h.
View newest version in sPHENIX GitHub at line 25 of file maxflow_ff.h
|
protected |
Definition at line 127 of file maxflow_ff.h.
View newest version in sPHENIX GitHub at line 127 of file maxflow_ff.h
__GTL_BEGIN_NAMESPACE maxflow_ff::maxflow_ff | ( | ) |
Default constructor. Enables only the calculation of maximum flow.
Definition at line 28 of file maxflow_ff.cpp.
View newest version in sPHENIX GitHub at line 28 of file maxflow_ff.cpp
References max_graph_flow, and set_vars_executed.
|
virtual |
Destructor.
Definition at line 35 of file maxflow_ff.cpp.
View newest version in sPHENIX GitHub at line 35 of file maxflow_ff.cpp
|
virtual |
Checks whether following preconditions are satisfied:
G
is directed. G
is connected. G
has at least one edge and two nodes. G | graph |
algorithm::GTL_OK
on success algorithm::GTL_ERROR
otherwise Implements algorithm.
Definition at line 61 of file maxflow_ff.cpp.
View newest version in sPHENIX GitHub at line 61 of file maxflow_ff.cpp
References artif_source_target, edge_capacity, graph::edges_begin(), graph::edges_end(), algorithm::GTL_ERROR, algorithm::GTL_OK, graph::is_connected(), graph::is_undirected(), net_source, net_target, graph::nodes_begin(), graph::nodes_end(), graph::number_of_nodes(), and set_vars_executed.
|
protected |
Definition at line 328 of file maxflow_ff.cpp.
View newest version in sPHENIX GitHub at line 328 of file maxflow_ff.cpp
References edge_max_flow, max_graph_flow, net_source, node::out_edges_begin(), and node::out_edges_end().
Referenced by restore_graph().
Definition at line 207 of file maxflow_ff.cpp.
View newest version in sPHENIX GitHub at line 207 of file maxflow_ff.cpp
References back_edge, back_edge_exists, create_back_edge(), edge_capacity, edge_max_flow, edge_org, extra_charge(), graph::hide_edge(), net_source, net_target, and graph::restore_edge().
Referenced by run().
|
protected |
Definition at line 259 of file maxflow_ff.cpp.
View newest version in sPHENIX GitHub at line 259 of file maxflow_ff.cpp
References net_target, next, NO_SP_FOUND, node::out_edges_begin(), node::out_edges_end(), and SP_FOUND.
Referenced by get_sp().
|
protected |
Definition at line 160 of file maxflow_ff.cpp.
View newest version in sPHENIX GitHub at line 160 of file maxflow_ff.cpp
References Acts::UnitConstants::e, edge_capacity, node::indeg(), net_source, net_target, graph::new_edge(), graph::new_node(), graph::nodes_begin(), graph::nodes_end(), and node::outdeg().
Referenced by run().
Definition at line 314 of file maxflow_ff.cpp.
View newest version in sPHENIX GitHub at line 314 of file maxflow_ff.cpp
References back_edge, back_edge_exists, edge_capacity, edge_max_flow, edge_org, edges_not_org, graph::new_edge(), edge::source(), and edge::target().
Referenced by comp_single_flow().
Definition at line 294 of file maxflow_ff.cpp.
View newest version in sPHENIX GitHub at line 294 of file maxflow_ff.cpp
References edge_capacity, edge_max_flow, net_source, and net_target.
Referenced by comp_single_flow().
Returns the maximum flow of an edge.
e | edge of a graph G |
Definition at line 137 of file maxflow_ff.cpp.
View newest version in sPHENIX GitHub at line 137 of file maxflow_ff.cpp
References edge_max_flow.
double maxflow_ff::get_max_flow | ( | ) | const |
Returns the maximum flow of the whole graph G.
Definition at line 143 of file maxflow_ff.cpp.
View newest version in sPHENIX GitHub at line 143 of file maxflow_ff.cpp
References max_graph_flow.
Returns the remaining free capacity of an edge.
e | edge of a graph G |
Definition at line 149 of file maxflow_ff.cpp.
View newest version in sPHENIX GitHub at line 149 of file maxflow_ff.cpp
References edge_capacity, and edge_max_flow.
Definition at line 241 of file maxflow_ff.cpp.
View newest version in sPHENIX GitHub at line 241 of file maxflow_ff.cpp
References comp_sp(), net_source, NO_SP_FOUND, and SP_FOUND.
Referenced by run().
|
protected |
Definition at line 198 of file maxflow_ff.cpp.
View newest version in sPHENIX GitHub at line 198 of file maxflow_ff.cpp
References back_edge_exists, edge_max_flow, edge_org, ne_map< Key, Value, Graph, Alloc >::init(), and max_graph_flow.
Referenced by run().
|
virtual |
Resets maximum flow algorithm, i.e. prepares the algorithm to be applied to another graph.
Implements algorithm.
Definition at line 155 of file maxflow_ff.cpp.
View newest version in sPHENIX GitHub at line 155 of file maxflow_ff.cpp
|
protected |
Definition at line 342 of file maxflow_ff.cpp.
View newest version in sPHENIX GitHub at line 342 of file maxflow_ff.cpp
References artif_source_target, comp_max_flow(), graph::del_edge(), graph::del_node(), edges_not_org, net_source, net_target, and graph::restore_graph().
Referenced by run().
|
virtual |
Computes maximum flow of graph G
.
G | graph |
algorithm::GTL_OK
on success algorithm::GTL_ERROR
otherwise Implements algorithm.
Definition at line 116 of file maxflow_ff.cpp.
View newest version in sPHENIX GitHub at line 116 of file maxflow_ff.cpp
References artif_source_target, comp_single_flow(), create_artif_source_target(), get_sp(), algorithm::GTL_OK, prepare_run(), restore_graph(), and SP_FOUND.
Sets capacity of every edge for maximum flow calculation where artificial start-node and end_node will be computed automatically.
edge_capacity | capacity of every edge |
Definition at line 40 of file maxflow_ff.cpp.
View newest version in sPHENIX GitHub at line 40 of file maxflow_ff.cpp
References artif_source_target, edge_capacity, max_graph_flow, and set_vars_executed.
void maxflow_ff::set_vars | ( | const edge_map< double > & | edge_capacity, |
const node & | net_source, | ||
const node & | net_target | ||
) |
Sets capacity of every edge for maximum flow calculation
edge_capacity | capacity of every edge |
net_source | start-node |
net_target | end-node |
Definition at line 49 of file maxflow_ff.cpp.
View newest version in sPHENIX GitHub at line 49 of file maxflow_ff.cpp
References artif_source_target, edge_capacity, max_graph_flow, net_source, net_target, and set_vars_executed.
|
protected |
Definition at line 132 of file maxflow_ff.h.
View newest version in sPHENIX GitHub at line 132 of file maxflow_ff.h
Referenced by check(), restore_graph(), run(), and set_vars().
Definition at line 172 of file maxflow_ff.h.
View newest version in sPHENIX GitHub at line 172 of file maxflow_ff.h
Referenced by comp_single_flow(), and create_back_edge().
|
protected |
Definition at line 167 of file maxflow_ff.h.
View newest version in sPHENIX GitHub at line 167 of file maxflow_ff.h
Referenced by comp_single_flow(), create_back_edge(), and prepare_run().
Definition at line 177 of file maxflow_ff.h.
View newest version in sPHENIX GitHub at line 177 of file maxflow_ff.h
Referenced by check(), comp_single_flow(), create_artif_source_target(), create_back_edge(), extra_charge(), get_rem_cap(), and set_vars().
Definition at line 182 of file maxflow_ff.h.
View newest version in sPHENIX GitHub at line 182 of file maxflow_ff.h
Referenced by comp_max_flow(), comp_single_flow(), create_back_edge(), extra_charge(), get_max_flow(), get_rem_cap(), and prepare_run().
|
protected |
Definition at line 162 of file maxflow_ff.h.
View newest version in sPHENIX GitHub at line 162 of file maxflow_ff.h
Referenced by comp_single_flow(), create_back_edge(), and prepare_run().
|
protected |
Definition at line 157 of file maxflow_ff.h.
View newest version in sPHENIX GitHub at line 157 of file maxflow_ff.h
Referenced by create_back_edge(), and restore_graph().
|
protected |
Definition at line 142 of file maxflow_ff.h.
View newest version in sPHENIX GitHub at line 142 of file maxflow_ff.h
Referenced by comp_max_flow(), get_max_flow(), maxflow_ff(), prepare_run(), and set_vars().
|
protected |
Definition at line 147 of file maxflow_ff.h.
View newest version in sPHENIX GitHub at line 147 of file maxflow_ff.h
Referenced by check(), comp_max_flow(), comp_single_flow(), create_artif_source_target(), extra_charge(), get_sp(), restore_graph(), and set_vars().
|
protected |
Definition at line 152 of file maxflow_ff.h.
View newest version in sPHENIX GitHub at line 152 of file maxflow_ff.h
Referenced by check(), comp_single_flow(), comp_sp(), create_artif_source_target(), extra_charge(), restore_graph(), and set_vars().
|
protected |
Definition at line 137 of file maxflow_ff.h.
View newest version in sPHENIX GitHub at line 137 of file maxflow_ff.h
Referenced by check(), maxflow_ff(), and set_vars().