Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Short_Cycle_Result< GT, Cost_Type > Struct Template Reference

Exact optimum returned by most_negative_cycle_up_to_3(). More...

#include <Negative_Cycles.H>

Collaboration diagram for Aleph::Short_Cycle_Result< GT, Cost_Type >:
[legend]

Public Member Functions

bool is_negative () const noexcept
 Whether the optimum has strictly negative total cost.
 

Public Attributes

bool has_cycle = false
 Whether a cycle within the bound exists.
 
Cost_Type total_cost = Cost_Type{0}
 Exact weight sum, rounded for floating-point costs.
 
size_t length = 0
 Number of arcs, at most three.
 
DynList< typename GT::Node * > cycle_nodes
 Closed node list, first node repeated last.
 
DynList< typename GT::Arc * > cycle_arcs
 Original arcs aligned with consecutive nodes.
 

Detailed Description

template<AlephGraph GT, typename Cost_Type>
struct Aleph::Short_Cycle_Result< GT, Cost_Type >

Exact optimum returned by most_negative_cycle_up_to_3().

When has_cycle, the witness is a minimum-total-cost simple cycle within the requested bound, with the fewest arcs among all minimizers. Floating-point weights are compared as exact binary numbers; only the published total is rounded (within one ulp, with the exact sign). Unlike Bounded_Cycle_Result, this result needs no relaxed-walk certificate. Pointers belong to the input graph and share its lifetime requirements.

Template Parameters
GTDirected graph type.
Cost_TypeArc weight type.

Definition at line 343 of file Negative_Cycles.H.

Member Function Documentation

◆ is_negative()

template<AlephGraph GT, typename Cost_Type >
bool Aleph::Short_Cycle_Result< GT, Cost_Type >::is_negative ( ) const
inlinenoexcept

Whether the optimum has strictly negative total cost.

Returns
True exactly when a negative cycle within the bound exists.

Definition at line 354 of file Negative_Cycles.H.

References Aleph::and, Aleph::Short_Cycle_Result< GT, Cost_Type >::has_cycle, and Aleph::Short_Cycle_Result< GT, Cost_Type >::total_cost.

Member Data Documentation

◆ cycle_arcs

template<AlephGraph GT, typename Cost_Type >
DynList<typename GT::Arc *> Aleph::Short_Cycle_Result< GT, Cost_Type >::cycle_arcs

Original arcs aligned with consecutive nodes.

Definition at line 349 of file Negative_Cycles.H.

Referenced by Aleph::most_negative_cycle_up_to_3().

◆ cycle_nodes

template<AlephGraph GT, typename Cost_Type >
DynList<typename GT::Node *> Aleph::Short_Cycle_Result< GT, Cost_Type >::cycle_nodes

Closed node list, first node repeated last.

Definition at line 348 of file Negative_Cycles.H.

Referenced by Aleph::most_negative_cycle_up_to_3().

◆ has_cycle

template<AlephGraph GT, typename Cost_Type >
bool Aleph::Short_Cycle_Result< GT, Cost_Type >::has_cycle = false

Whether a cycle within the bound exists.

Definition at line 345 of file Negative_Cycles.H.

Referenced by Aleph::Short_Cycle_Result< GT, Cost_Type >::is_negative(), and Aleph::most_negative_cycle_up_to_3().

◆ length

template<AlephGraph GT, typename Cost_Type >
size_t Aleph::Short_Cycle_Result< GT, Cost_Type >::length = 0

Number of arcs, at most three.

Definition at line 347 of file Negative_Cycles.H.

Referenced by Aleph::most_negative_cycle_up_to_3().

◆ total_cost

template<AlephGraph GT, typename Cost_Type >
Cost_Type Aleph::Short_Cycle_Result< GT, Cost_Type >::total_cost = Cost_Type{0}

Exact weight sum, rounded for floating-point costs.

Definition at line 346 of file Negative_Cycles.H.

Referenced by Aleph::Short_Cycle_Result< GT, Cost_Type >::is_negative(), and Aleph::most_negative_cycle_up_to_3().


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