#include <digraphx/min_cycle_ratio.hpp>
template<typename DiGraph, typename Ratio>
CycleRatioAPI class
Template parameters | |
---|---|
DiGraph | |
Ratio |
The CycleRatioAPI
class is a template class that provides an interface for calculating distances and performing zero cancellation on cycles in a directed graph. It takes two template parameters: DiGraph
, which represents the directed graph type, and Ratio
, which represents the ratio type used for calculations.
Constructors, destructors, conversion operators
- CycleRatioAPI(const DiGraph& gra) explicit
- Construct a new Cycle Ratio API object.
Public functions
- auto distance(Ratio& ratio, const Edge& edge) const -> Ratio -> auto
- distance between two end points of an edge
- auto zero_cancel(const Cycle& cycle) const -> Ratio -> auto
Function documentation
template<typename DiGraph, typename Ratio>
CycleRatioAPI<DiGraph, Ratio>:: CycleRatioAPI(const DiGraph& gra) explicit
Construct a new Cycle Ratio API object.
Parameters | |
---|---|
gra in | The gra parameter is a reference to a DiGraph object. It is used to initialize the gra member variable of the CycleRatioAPI class. The gra member variable is a constant reference to a DiGraph object, which means it cannot be modified |
The CycleRatioAPI
class constructor takes a reference to a DiGraph
object and initializes its gra
member variable.
template<typename DiGraph, typename Ratio>
auto CycleRatioAPI<DiGraph, Ratio>:: distance(Ratio& ratio,
const Edge& edge) const -> Ratio
distance between two end points of an edge
Parameters | |
---|---|
ratio in | A reference to a Ratio object named ratio . |
edge in | The edge parameter is a constant reference to an Edge object. It represents an edge in a graph connecting two vertices. |
Returns | a Ratio object. |
The distance
function calculates the distance between two vertices in a graph based on the cost and time values associated with the edge connecting them.
template<typename DiGraph, typename Ratio>
auto CycleRatioAPI<DiGraph, Ratio>:: zero_cancel(const Cycle& cycle) const -> Ratio
Parameters | |
---|---|
cycle in | The cycle parameter is of type Cycle , which is likely a container or data structure that represents a cycle in a graph. It is used to calculate the ratio of the total cost to the total time for the given cycle. |
Returns | The zero_cancel function returns the ratio of the total cost to the total time for a given cycle. |
The zero_cancel
function calculates the ratio of the total cost to the total time for a given cycle.