Class ChinesePostmanAbstract

java.lang.Object
com.jgalgo.alg.cycle.ChinesePostmanAbstract
All Implemented Interfaces:
ChinesePostman
Direct Known Subclasses:
ChinesePostmanImpl

public abstract class ChinesePostmanAbstract extends Object implements ChinesePostman
Abstract class for computing a shortest edge visitor circle 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

    • ChinesePostmanAbstract

      public ChinesePostmanAbstract()
      Default constructor.
  • Method Details

    • computeShortestEdgeVisitorCircleIfExist

      public <V, E> Optional<Path<V,E>> computeShortestEdgeVisitorCircleIfExist(Graph<V,E> g, WeightFunction<E> w)
      Description copied from interface: ChinesePostman
      Compute the shortest circuit that visits all edges in the graph at least once, if it exist.

      If g is IntGraph, the returned object is an optional of IPath. If g is IntGraph, prefer to pass IWeightFunction for best performance.

      Specified by:
      computeShortestEdgeVisitorCircleIfExist in interface ChinesePostman
      Type Parameters:
      V - the vertices type
      E - the edges type
      Parameters:
      g - a graph
      w - an edge weight function
      Returns:
      an optional of closed path that visits all edges in the graph, with minimum weight sum with respect to the given edge weight function, or empty if no solution exists (the graph is not strongly connected)