uchicago.src.sim.topology.graph.util
Class BreadthFirstSearch

java.lang.Object
  extended byuchicago.src.sim.topology.graph.util.BreadthFirstSearch
All Implemented Interfaces:
java.util.Iterator, java.io.Serializable

public class BreadthFirstSearch
extends java.lang.Object
implements java.util.Iterator, java.io.Serializable

Version:
$Revision: 1.5 $
Author:
Tom Howe
See Also:
Serialized Form

Constructor Summary
BreadthFirstSearch(Graph g)
          This is the general constructor for when you want to construct a BreadthFirstSearch on an entire graph.
BreadthFirstSearch(Graph g, java.lang.Object o)
          This constructor should be used if you want to start a search from a particular node.
 
Method Summary
 boolean hasNext()
          Determines if there is an unexplored node remaining in the graph.
 java.lang.Object next()
          Returns the next unexplored node in the graph.
 void remove()
          Unsupported Operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BreadthFirstSearch

public BreadthFirstSearch(Graph g,
                          java.lang.Object o)
This constructor should be used if you want to start a search from a particular node. This is useful if you are interested in traversing a component.

Parameters:
g - The graph to search.
o - The object to start the search

BreadthFirstSearch

public BreadthFirstSearch(Graph g)
This is the general constructor for when you want to construct a BreadthFirstSearch on an entire graph. This guarantees to return the nodes in the order that the links and components were added.

Parameters:
g - The graph to search
Method Detail

hasNext

public boolean hasNext()
Determines if there is an unexplored node remaining in the graph.

Specified by:
hasNext in interface java.util.Iterator
See Also:
Iterator.hasNext()

next

public java.lang.Object next()
Returns the next unexplored node in the graph.

Specified by:
next in interface java.util.Iterator
See Also:
Iterator.next()

remove

public void remove()
Unsupported Operation.

Specified by:
remove in interface java.util.Iterator
See Also:
Iterator.remove()