Class MinimumMeanCycleAbstract

java.lang.Object
com.jgalgo.alg.cycle.MinimumMeanCycleAbstract
All Implemented Interfaces:
MinimumMeanCycle
Direct Known Subclasses:
MinimumMeanCycleDasdanGupta, MinimumMeanCycleHoward

public abstract class MinimumMeanCycleAbstract extends Object implements MinimumMeanCycle
Abstract class for computing the cycle with minimum mean weight in a graph.

The class implements the interface by solving the problem on the index graph and then maps the results back to the original graph. The implementation for index graphs is abstract and left to the subclasses.

Author:
Barak Ugav
  • Constructor Details

    • MinimumMeanCycleAbstract

      public MinimumMeanCycleAbstract()
      Default constructor.
  • Method Details

    • computeMinimumMeanCycle

      public <V, E> Path<V,E> computeMinimumMeanCycle(Graph<V,E> g, WeightFunction<E> w)
      Description copied from interface: MinimumMeanCycle
      Compute the minimum mean cycle in a graph.

      If g is an IntGraph, a IPath object will be returned. In that case, its better to pass a IWeightFunction as w to avoid boxing/unboxing.

      Specified by:
      computeMinimumMeanCycle in interface MinimumMeanCycle
      Type Parameters:
      V - the vertices type
      E - the edges type
      Parameters:
      g - a graph
      w - an edge weight function
      Returns:
      the cycle with the minimum mean weight in the graph, or null if no cycles were found