Package com.jgalgo.alg.cycle
Class ChinesePostmanAbstract
java.lang.Object
com.jgalgo.alg.cycle.ChinesePostmanAbstract
- All Implemented Interfaces:
ChinesePostman
- Direct Known Subclasses:
ChinesePostmanImpl
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptioncomputeShortestEdgeVisitorCircleIfExist
(Graph<V, E> g, WeightFunction<E> w) Compute the shortest circuit that visits all edges in the graph at least once, if it exist.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.jgalgo.alg.cycle.ChinesePostman
computeShortestEdgeVisitorCircle
-
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
isIntGraph
, the returned object is an optional ofIPath
. Ifg
isIntGraph
, prefer to passIWeightFunction
for best performance.- Specified by:
computeShortestEdgeVisitorCircleIfExist
in interfaceChinesePostman
- Type Parameters:
V
- the vertices typeE
- the edges type- Parameters:
g
- a graphw
- 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)
-