UC Berkeley Group for User Interface Research
Updated November 17, 2000

edu.berkeley.guir.lib.graphs
Class SearchBreadthFirst

java.lang.Object
  |
  +--edu.berkeley.guir.lib.graphs.SearchBreadthFirst
All Implemented Interfaces:
GraphConst, GraphSearch, Serializable

public class SearchBreadthFirst
extends Object
implements GraphConst, GraphSearch, Serializable

A breadth first search for Graph.

This software is distributed under the Berkeley Software License.

 Revisions:  - GUIRLib-v1.0-1.0.0, Dec 20 1997, JH
               Created class
             - GUIRLib-v1.0-1.1.0, Feb 24 2000, JH
               Updated for JDK1.3RC1 to use the Collections
             - GUIRLib-v1.2-1.0.0, Jun 22 2000, JH
               Touched for GUIRLib release
             - GUIRLib-v1.3-1.0.0, Aug 11 2000, JH
               Touched for GUIRLib release
             - GUIRLib-v1.4-1.0.0, Aug 31 2000, JH
               Touched for GUIRLib release
 

Since:
1.1.4
Version:
GUIRLib-v1.4-1.0.0, Aug 31 2000
Author:
Jason Hong ( jasonh@cs.berkeley.edu)
See Also:
Serialized Form

Fields inherited from interface edu.berkeley.guir.lib.graphs.GraphConst
DEFAULT_NUMBER_EDGES, DEFAULT_NUMBER_NODES, DEFAULT_PATH_SIZE, DEFAULT_WEIGHT, ERROR, TRUE
 
Constructor Summary
SearchBreadthFirst()
           
 
Method Summary
 Path search(Graph g, String strFrom, String strTo)
          Perform a breadth-first search on the graph, with the specified start and target nodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchBreadthFirst

public SearchBreadthFirst()
Method Detail

search

public Path search(Graph g,
                   String strFrom,
                   String strTo)
Perform a breadth-first search on the graph, with the specified start and target nodes. Breadth-first-search is guaranteed to return the path with the shortest number of "hops" (ie edges).
Specified by:
search in interface GraphSearch
Parameters:
g - is the graph we are searching in.
strFrom - is the name of the starting node.
strTo - is the name of the target node.
Returns:
Returns the first successful Path found from the start node to the target node. The Path is empty if no successful Path is found, or if either the start or target node does not exist in the Graph.

Copyright Information