Class Graph<E>
- java.lang.Object
-
- org.glassfish.pfl.basic.algorithm.Graph<E>
-
public class Graph<E> extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Graph.Finder<E>
A Finder finds the immediate successors of an element of the graph.
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<E>
postorderTraversal
private java.util.List<E>
preorderTraversal
private java.util.Set<E>
roots
-
Constructor Summary
Constructors Constructor Description Graph(E root, Graph.Finder<E> finder)
Graph(java.util.Collection<E> roots, Graph.Finder<E> finder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<E>
getPostorderList()
java.util.List<E>
getPreorderList()
java.util.Set<E>
getRoots()
private void
init(java.util.Collection<E> roots, Graph.Finder<E> finder)
private void
traverse(E node, java.util.Set<E> visited, Graph.Finder<E> finder)
-
-
-
Constructor Detail
-
Graph
public Graph(java.util.Collection<E> roots, Graph.Finder<E> finder)
-
Graph
public Graph(E root, Graph.Finder<E> finder)
-
-
Method Detail
-
traverse
private void traverse(E node, java.util.Set<E> visited, Graph.Finder<E> finder)
-
init
private void init(java.util.Collection<E> roots, Graph.Finder<E> finder)
-
getRoots
public java.util.Set<E> getRoots()
-
getPreorderList
public java.util.List<E> getPreorderList()
-
getPostorderList
public java.util.List<E> getPostorderList()
-
-