salvo.jesus.graph.algorithm
Class BreadthFirstTraversal
java.lang.Object
salvo.jesus.graph.algorithm.GraphTraversal
salvo.jesus.graph.algorithm.BreadthFirstTraversal
- All Implemented Interfaces:
- java.io.Serializable
public class BreadthFirstTraversal
- extends GraphTraversal
A concrete subclass of GraphTraversal that uses breadth-first search
in traversing a graph. Note that the traverse() method will only
traverse the connected set to which the Vertex the traversal will start at belongs.
- Author:
- Jesus M. Salvo Jr.
- See Also:
- Serialized Form
Method Summary |
java.util.Vector |
traverse(Vertex startat)
Abstract traversal method to be implemented by subclasses. |
int |
traverse(Vertex startat,
java.util.Vector visited,
Visitor visitor)
Abstract traversal method to be implemented by subclasses. |
java.util.Vector |
traverse(Vertex startat,
Visitor visitor)
Abstract traversal method to be implemented by subclasses. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
queue
Queue queue
BreadthFirstTraversal
public BreadthFirstTraversal(Graph graph)
- Creates a BreadthFirstTraversal object
traverse
public int traverse(Vertex startat,
java.util.Vector visited,
Visitor visitor)
- Description copied from class:
GraphTraversal
- Abstract traversal method to be implemented by subclasses.
- Specified by:
traverse
in class GraphTraversal
- Parameters:
startat
- The vertex from which traversal will start.visited
- A Vector of vertices that has been visited in sequence by the traversalvisitor
- Visitor object controlling if and when traversal will stop,
apart from having visited all the vertices.
traverse
public java.util.Vector traverse(Vertex startat,
Visitor visitor)
- Description copied from class:
GraphTraversal
- Abstract traversal method to be implemented by subclasses.
- Specified by:
traverse
in class GraphTraversal
- Parameters:
startat
- The vertex from which traversal will start.visitor
- Visitor object controlling if and when traversal will stop,
apart from having visited all the vertices.
- Returns:
- A Vector of vertices that has been visited in sequence by the traversal
traverse
public java.util.Vector traverse(Vertex startat)
- Description copied from class:
GraphTraversal
- Abstract traversal method to be implemented by subclasses.
- Specified by:
traverse
in class GraphTraversal
- Parameters:
startat
- The vertex from which traversal will start.
- Returns:
- A Vector of vertices that has been visited in sequence by the traversal