|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
TVertex - Type of IVertex that a topological sort will operate on.public interface ITopologicalSortStrategy<TVertex extends IVertex<TValue>,TValue,TProcessedValue>
Provides a strategy for implementing a topological sort of an IGraph.
A IGraph is first transformed into an adjacency list of type IAdjacencyList. That is then used
to topologically sort the graph.
Two versions are provided: one will synchronously traverse the graph and provide the ordered list of vertices to
visit and the second will asynchronously process the graph executing in parallel as many as possible given the size
of a thread pool and the ordering.
| Field Summary | |
|---|---|
static String |
STANDARD_CYCLE_MESSAGE
String available for use when throwing CyclicGraphExceptions. |
| Method Summary | |
|---|---|
List<TValue> |
sort(IAdjacencyList<TVertex,TValue,TProcessedValue> adjacencyList)
Given an instance of IAdjacencyList, topologically sorts the graph. |
ITopologicalSortAsyncResult<TValue,TProcessedValue> |
sortAsync(ExecutorService executor,
IAdjacencyList<TVertex,TValue,TProcessedValue> adjacencyList,
ITopologicalSortCallback<TValue,TProcessedValue> callback,
ITopologicalSortErrorCallback<TValue> errorCallback)
Allows you to asynchronously and in-parallel process the vertices of a graph topologically. |
| Field Detail |
|---|
static final String STANDARD_CYCLE_MESSAGE
String available for use when throwing CyclicGraphExceptions.
| Method Detail |
|---|
List<TValue> sort(IAdjacencyList<TVertex,TValue,TProcessedValue> adjacencyList)
throws CyclicGraphException
IAdjacencyList, topologically sorts the graph.
adjacencyList - An instance of IAdjacencyList.
IGraph.
CyclicGraphException - A CyclicGraphException is thrown if a cycle is detected during the sort.
ITopologicalSortAsyncResult<TValue,TProcessedValue> sortAsync(ExecutorService executor,
IAdjacencyList<TVertex,TValue,TProcessedValue> adjacencyList,
ITopologicalSortCallback<TValue,TProcessedValue> callback,
ITopologicalSortErrorCallback<TValue> errorCallback)
executor - An instance of ExecutorService that will be used to submit tasks for processing
vertices.adjacencyList - An instance of IAdjacencyList.callback - An instance of ITopologicalSortCallback that will be called to process each vertex.
This may be called concurrently depending on the makeup of the graph.errorCallback - An instance of ITopologicalSortErrorCallback that will be called if an error during
processing occurs either in the
ITopologicalSortCallback.handle(Object, ITopologicalSortInput, IVertex, ITopologicalSortCoordinator) method or in the
sortAsync(java.util.concurrent.ExecutorService, IAdjacencyList, ITopologicalSortCallback, ITopologicalSortErrorCallback)
method.
ITopologicalSortAsyncResult that allows the caller to coordinate the
asynchronous processing of the graph.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||