Package com.jgalgo.alg.dag
Class TopologicalOrderAlgoAbstract
- java.lang.Object
-
- com.jgalgo.alg.dag.TopologicalOrderAlgoAbstract
-
- All Implemented Interfaces:
TopologicalOrderAlgo
- Direct Known Subclasses:
TopologicalOrderAlgoImpl
public abstract class TopologicalOrderAlgoAbstract extends Object implements TopologicalOrderAlgo
Abstract class for computing a topological order in a DAG 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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.jgalgo.alg.dag.TopologicalOrderAlgo
TopologicalOrderAlgo.IResult, TopologicalOrderAlgo.Result<V,E>
-
-
Constructor Summary
Constructors Constructor Description TopologicalOrderAlgoAbstract()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <V,E>
Optional<TopologicalOrderAlgo.Result<V,E>>computeTopologicalSortingIfExist(Graph<V,E> g)
Compute the topological order of the vertices, if the graph is DAG.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.jgalgo.alg.dag.TopologicalOrderAlgo
computeTopologicalSorting
-
-
-
-
Method Detail
-
computeTopologicalSortingIfExist
public <V,E> Optional<TopologicalOrderAlgo.Result<V,E>> computeTopologicalSortingIfExist(Graph<V,E> g)
Description copied from interface:TopologicalOrderAlgo
Compute the topological order of the vertices, if the graph is DAG.If
g
isIntGraph
, the returned optional will contain isTopologicalOrderAlgo.IResult
.- Specified by:
computeTopologicalSortingIfExist
in interfaceTopologicalOrderAlgo
- Type Parameters:
V
- the vertices typeE
- the edges type- Parameters:
g
- a directed graph- Returns:
- an optional of a result object containing the computed order, or an empty optional if the graph is not DAG
-
-