Package com.jgalgo.alg.dag
Class TopologicalOrderAlgoAbstract
java.lang.Object
com.jgalgo.alg.dag.TopologicalOrderAlgoAbstract
- All Implemented Interfaces:
TopologicalOrderAlgo
- Direct Known Subclasses:
TopologicalOrderAlgoImpl
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
-
Method Summary
Modifier and TypeMethodDescription<V,
E> Optional <TopologicalOrderAlgo.Result<V, E>> 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
-
Constructor Details
-
TopologicalOrderAlgoAbstract
public TopologicalOrderAlgoAbstract()Default constructor.
-
-
Method Details
-
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
-