Package dsa
Class Topological
java.lang.Object
dsa.Topological
An immutable data type to determine whether a digraph has a topological order and, if so, find such an order.
-
Constructor Summary
ConstructorDescriptionDetermines whether the digraphG
has a topological order and, if so, finds such an order. -
Method Summary
-
Constructor Details
-
Topological
Determines whether the digraphG
has a topological order and, if so, finds such an order.- Parameters:
G
- the digraph.
-
-
Method Details
-
hasOrder
public boolean hasOrder()Returnstrue
if there exists a topological order, andfalse
otherwise.- Returns:
true
if there exists a topological order, andfalse
otherwise.
-
order
Returns a topological order, ornull
.- Returns:
- a topological order, or
null
.
-
main
Unit tests the data type.- Parameters:
args
- the command-line arguments.
-