Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
min_mean_cycle_example.cc File Reference

Example: Karp minimum mean cycle on Aleph digraphs. More...

#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <Min_Mean_Cycle.H>
#include <tpl_graph.H>
Include dependency graph for min_mean_cycle_example.cc:

Go to the source code of this file.

Functions

int main ()
 Example program demonstrating Karp's minimum mean cycle algorithm on Aleph digraphs.
 

Detailed Description

Example: Karp minimum mean cycle on Aleph digraphs.

Build and run:

cmake -S . -B build cmake –build build –target min_mean_cycle_example ./build/Examples/min_mean_cycle_example

Definition in file min_mean_cycle_example.cc.

Function Documentation

◆ main()

int main ( )

Example program demonstrating Karp's minimum mean cycle algorithm on Aleph digraphs.

Constructs a sample directed graph with six nodes (A–F), inserts arcs that create multiple cycles (including an optimal cycle B→D→E→B and a higher-cost cycle C↔F), and runs three variants of the algorithm:

  • full result with witness cycle,
  • value-only API reporting only the minimum mean,
  • filtered run that blocks a specified arc (D→E) via the Arc_Visible predicate. Results are printed to standard output.
Returns
int Exit status (0 on success).

Definition at line 177 of file min_mean_cycle_example.cc.

References Aleph::divide_and_conquer_partition_dp(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), Aleph::karp_minimum_mean_cycle(), Aleph::karp_minimum_mean_cycle_value(), and print_result().