gshute.graph
Class GraphSearcher

java.lang.Object
  |
  +--gshute.graph.GraphSearcher

public class GraphSearcher
extends java.lang.Object

A GraphSearcher conducts graph searches on searchable graphs.

After creating a graph searcher, a searchable graph is attached to it by calling setGraph(). The search ordering is determined by attaching a dispenser with setDispenser(). A graph search recorder is used to record necessary data as a search progresses and to determine which vertices have been visited. It is attached to the graph searcher by calling setRecorder(). After this setup, the attached graph is searched by calling search().


Field Summary
protected  Dispenser dispenser
          dispenser is the dispenser that this GraphSearcher will use to determine the order of visiting vertices.
protected  SearchableGraph graph
          graph is the graph that this GraphSearcher will search.
protected  GraphSearchRecorder recorder
          recorder is the graph search recorder that this GraphSearcher will use to record visition of vertices.
 
Constructor Summary
GraphSearcher()
           
 
Method Summary
 void search(java.lang.Object start)
          gs.search(start) searches the connected component containing start in the graph that is attached to gs.
 void setDispenser(Dispenser disp)
          gs.setDispenser(disp) attaches the dispenser disp to gs.
 void setGraph(SearchableGraph g)
          gs.setGraph(g) attaches the graph g to gs.
 void setRecorder(GraphSearchRecorder rcrdr)
          gs.setRecorder(rcrdr) attaches the recorder rcrdr to gs.
protected  boolean visit(java.lang.Object v, java.lang.Object via)
          visit(v, via) handles arrival at a previously unvisited vertex v through edge via.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

graph

protected SearchableGraph graph
graph is the graph that this GraphSearcher will search.

dispenser

protected Dispenser dispenser
dispenser is the dispenser that this GraphSearcher will use to determine the order of visiting vertices.

recorder

protected GraphSearchRecorder recorder
recorder is the graph search recorder that this GraphSearcher will use to record visition of vertices.
Constructor Detail

GraphSearcher

public GraphSearcher()
Method Detail

search

public void search(java.lang.Object start)
gs.search(start) searches the connected component containing start in the graph that is attached to gs. The search begins at vertex start. The search ordering is determined by the dispenser that is attached to gs.

Preconditions: A graph has been attached to gs using setGraph(); A dispenser has been attached to gs using setDispenser(); A search recorder has been attached to gs using setRecorder();


setGraph

public void setGraph(SearchableGraph g)
gs.setGraph(g) attaches the graph g to gs.

setDispenser

public void setDispenser(Dispenser disp)
gs.setDispenser(disp) attaches the dispenser disp to gs.

setRecorder

public void setRecorder(GraphSearchRecorder rcrdr)
gs.setRecorder(rcrdr) attaches the recorder rcrdr to gs.

visit

protected boolean visit(java.lang.Object v,
                        java.lang.Object via)
visit(v, via) handles arrival at a previously unvisited vertex v through edge via. If it returns true then the search terminates.