Package com.gengoai.graph.algorithms
Class AbstractGraphTraversal<V>
- java.lang.Object
-
- com.gengoai.graph.algorithms.AbstractGraphTraversal<V>
-
- Type Parameters:
V
- the type parameter
- All Implemented Interfaces:
GraphTraversal<V>
,Serializable
- Direct Known Subclasses:
BreadthFirstTraversal
,DepthFirstTraversal
public abstract class AbstractGraphTraversal<V> extends Object implements GraphTraversal<V>, Serializable
Abstract traversal for depth first and breadth first traversals- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractGraphTraversal(Graph<V> graph)
Instantiates a new Abstract graph traversal.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
add(Deque<V> deque, V vertex)
Add.protected Graph<V>
getGraph()
Iterator<V>
iterator(V startingPoint)
An iterator to traverse the graph starting at the given vertexprotected abstract V
nextV(Deque<V> deque)
Next v v.
-
-
-
Method Detail
-
iterator
public final Iterator<V> iterator(V startingPoint)
Description copied from interface:GraphTraversal
An iterator to traverse the graph starting at the given vertex- Specified by:
iterator
in interfaceGraphTraversal<V>
- Parameters:
startingPoint
- the starting point- Returns:
- the iterator
-
add
protected abstract void add(Deque<V> deque, V vertex)
Add.- Parameters:
deque
- the dequevertex
- the vertex
-
-