V - the vertex type; often Coordpublic class DirectedGraphAlgorithms<V> extends Algorithms<V>
CostlyGraph, as well as general Algorithms.
Currently, this only adds a topologicalSort() method and its overload.| Modifier and Type | Method and Description |
|---|---|
boolean |
topologicalSort()
Sort the vertices of this graph in topological order.
|
boolean |
topologicalSort(java.util.ArrayList<V> sortedVertices)
Perform a topological sort on the graph, and puts the sorted vertices in the supplied list.
|
breadthFirstSearch, breadthFirstSearch, depthFirstSearch, depthFirstSearch, detectCycle, findMinimumDistance, findShortestPath, findShortestPath, findShortestPath, lastRunIDpublic boolean topologicalSort()
Graph.getVertices(). Note that the graph cannot contain any cycles for a topological order to exist. If a
cycle exists, this method will do nothing.public boolean topologicalSort(java.util.ArrayList<V> sortedVertices)
sortedVertices - an ArrayList of V vertices that will be cleared and modified in-placeCopyright © Eben Howard 2012–2022. All rights reserved.