public class DFS extends Object
Constructor and Description |
---|
DFS() |
Modifier and Type | Method and Description |
---|---|
static <T> Set<T> |
getReachableNodes(Graph<T> G)
Perform a DFS and return the set of all nodes visited.
|
static <T> Set<T> |
getReachableNodes(Graph<T> G,
Collection<? extends T> C)
Perform a DFS starting with a particular node set and return the set of all nodes visited.
|
static <T> Collection<T> |
getReachableNodes(Graph<T> G,
Collection<? extends T> C,
Predicate filter)
Perform a DFS starting with a particular node and return the set of all nodes visited.
|
static <T> DFSDiscoverTimeIterator<T> |
iterateDiscoverTime(Graph<T> G) |
static <T> Iterator<T> |
iterateDiscoverTime(Graph<T> G,
Iterator<T> roots) |
static <T> DFSDiscoverTimeIterator<T> |
iterateDiscoverTime(Graph<T> G,
T N) |
static <T> DFSFinishTimeIterator<T> |
iterateFinishTime(Graph<T> G) |
static <T> DFSFinishTimeIterator<T> |
iterateFinishTime(Graph<T> G,
Iterator<? extends T> ie) |
static <T> SortedSet<T> |
sortByDepthFirstOrder(Graph<T> G,
T n)
Perform a DFS of a graph starting with a specified node and return a sorted list of nodes.
|
public static <T> Collection<T> getReachableNodes(Graph<T> G, Collection<? extends T> C, Predicate filter)
C
- collection of nodes to start fromfilter
- only traverse nodes that need this filterIllegalArgumentException
- if C is nullpublic static <T> Set<T> getReachableNodes(Graph<T> G, Collection<? extends T> C)
G
- the graph containing nIllegalArgumentException
- if C is nullpublic static <T> Set<T> getReachableNodes(Graph<T> G) throws IllegalArgumentException
G
- the graph containing nIllegalArgumentException
- if G == nullpublic static <T> SortedSet<T> sortByDepthFirstOrder(Graph<T> G, T n)
G
- a graphn
- the initial nodepublic static <T> DFSDiscoverTimeIterator<T> iterateDiscoverTime(Graph<T> G)
G
- public static <T> Iterator<T> iterateDiscoverTime(Graph<T> G, Iterator<T> roots) throws IllegalArgumentException
roots
- roots of traversal, in order to visit in outermost loop of DFSIllegalArgumentException
- if roots == nullpublic static <T> DFSDiscoverTimeIterator<T> iterateDiscoverTime(Graph<T> G, T N)
N
- root of traversalpublic static <T> DFSFinishTimeIterator<T> iterateFinishTime(Graph<T> G) throws IllegalArgumentException
G
- a graphIllegalArgumentException
- if G == nullpublic static <T> DFSFinishTimeIterator<T> iterateFinishTime(Graph<T> G, Iterator<? extends T> ie)
G
- a graphie
- roots of traversal, in order to visit in outermost loop of DFS