|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Compute the total cost (sum of arc weights) of a graph. More...
#include <tpl_graph_utils.H>
Public Member Functions | |
| Total_Cost (Distance __dist=Distance(), SA __sa=SA()) | |
| Distance::Distance_Type | total_cost (GT &g) |
| Compute the total cost. | |
| Distance::Distance_Type | operator() (GT &g) |
See total_cost. | |
| void | reset () noexcept |
Reset the internal accumulator used by operator()(Arc*). | |
| Distance::Distance_Type | value () const noexcept |
Return the accumulated value (after using operator()(Arc*)). | |
| bool | operator() (typename GT::Arc *a) |
Private Attributes | |
| Distance | dist |
| SA | sa |
| Distance::Distance_Type | sum {} |
Compute the total cost (sum of arc weights) of a graph.
Iterates over all arcs of a graph (filtered by SA) and sums their distance/weight using the Distance accessor.
Two usage patterns:
total_cost(g) / operator()(g) to compute the sum for a whole graph.operator()(arc) as an accumulator with traversal utilities such as traverse_arcs(), then read the result via value().| GT | Graph type. |
| Distance | Distance accessor (defaults to Dft_Dist). |
| SA | Arc filter for Arc_Iterator. |
Definition at line 2586 of file tpl_graph_utils.H.
|
inline |
Definition at line 2594 of file tpl_graph_utils.H.
|
inline |
See total_cost.
Definition at line 2613 of file tpl_graph_utils.H.
References Aleph::Total_Cost< GT, Distance, SA >::total_cost().
|
inline |
Definition at line 2630 of file tpl_graph_utils.H.
References Aleph::Total_Cost< GT, Distance, SA >::dist, Aleph::Total_Cost< GT, Distance, SA >::sa, and Aleph::Total_Cost< GT, Distance, SA >::sum.
|
inlinenoexcept |
Reset the internal accumulator used by operator()(Arc*).
Definition at line 2619 of file tpl_graph_utils.H.
References Aleph::Total_Cost< GT, Distance, SA >::sum.
Referenced by TEST(), and TYPED_TEST().
|
inline |
Compute the total cost.
Definition at line 2601 of file tpl_graph_utils.H.
References Aleph::Total_Cost< GT, Distance, SA >::dist, Aleph::Total_Cost< GT, Distance, SA >::sa, and Aleph::Total_Cost< GT, Distance, SA >::sum.
Referenced by Aleph::Total_Cost< GT, Distance, SA >::operator()(), TEST(), and TYPED_TEST().
|
inlinenoexcept |
Return the accumulated value (after using operator()(Arc*)).
Definition at line 2625 of file tpl_graph_utils.H.
References Aleph::Total_Cost< GT, Distance, SA >::sum.
Referenced by TEST(), and TYPED_TEST().
|
private |
Definition at line 2588 of file tpl_graph_utils.H.
Referenced by Aleph::Total_Cost< GT, Distance, SA >::operator()(), and Aleph::Total_Cost< GT, Distance, SA >::total_cost().
|
private |
Definition at line 2589 of file tpl_graph_utils.H.
Referenced by Aleph::Total_Cost< GT, Distance, SA >::operator()(), and Aleph::Total_Cost< GT, Distance, SA >::total_cost().
|
private |
Definition at line 2590 of file tpl_graph_utils.H.
Referenced by Aleph::Total_Cost< GT, Distance, SA >::operator()(), Aleph::Total_Cost< GT, Distance, SA >::reset(), Aleph::Total_Cost< GT, Distance, SA >::total_cost(), and Aleph::Total_Cost< GT, Distance, SA >::value().