de.uka.algo.GT3D
Class BreadthFirstSearchDemo

java.lang.Object
  extended by de.uka.algo.GT3D.BreadthFirstSearchDemo
All Implemented Interfaces:
StepwiseAlgorithm

public class BreadthFirstSearchDemo
extends java.lang.Object
implements StepwiseAlgorithm

This class implements Breadth First Search.

Author:
stm

Field Summary
(package private)  java.util.LinkedList<edu.uci.ics.jung.graph.Vertex> candidates
          Waiting list for nodes
(package private)  boolean initialized
           
(package private)  boolean ready
           
private  edu.uci.ics.jung.graph.DirectedGraph theGraph
          The graph we are dealing with, Read in init.
(package private)  java.util.Map<edu.uci.ics.jung.graph.Vertex,java.lang.Boolean> visited
          Map of visited nodes
 
Constructor Summary
BreadthFirstSearchDemo()
           
 
Method Summary
 boolean atStart()
           
 boolean finished()
           
 javax.vecmath.Point3d getBoundingBox()
           
 void init()
           
 void init(edu.uci.ics.jung.graph.DirectedGraph aGraph)
           
 void init(java.lang.String filename)
          Initialize the graph, the map of visited nodes and put the first vertex into the queue.
protected  void markNode(edu.uci.ics.jung.graph.Vertex v)
          Visualize a visited node.
 void nextStep()
          Perform the next step of the search: Get the next vertex fromt the queue and mark. all its neighbours.
 void previousStep()
          this method does nothing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theGraph

private edu.uci.ics.jung.graph.DirectedGraph theGraph
The graph we are dealing with, Read in init.


candidates

java.util.LinkedList<edu.uci.ics.jung.graph.Vertex> candidates
Waiting list for nodes


visited

java.util.Map<edu.uci.ics.jung.graph.Vertex,java.lang.Boolean> visited
Map of visited nodes


initialized

boolean initialized

ready

boolean ready
Constructor Detail

BreadthFirstSearchDemo

public BreadthFirstSearchDemo()
Method Detail

getBoundingBox

public javax.vecmath.Point3d getBoundingBox()

init

public void init(edu.uci.ics.jung.graph.DirectedGraph aGraph)

init

public void init()

init

public void init(java.lang.String filename)
          throws FileFormatException
Initialize the graph, the map of visited nodes and put the first vertex into the queue.

Specified by:
init in interface StepwiseAlgorithm
Parameters:
filename - the name of the GraphML file to read from.
Throws:
FileFormatException
See Also:
StepwiseAlgorithm.init(java.lang.String)

nextStep

public void nextStep()
Perform the next step of the search: Get the next vertex fromt the queue and mark. all its neighbours.

Specified by:
nextStep in interface StepwiseAlgorithm
See Also:
StepwiseAlgorithm.nextStep()

markNode

protected void markNode(edu.uci.ics.jung.graph.Vertex v)
Visualize a visited node. For now we only print the node.

Parameters:
v - the current node.

previousStep

public void previousStep()
this method does nothing

Specified by:
previousStep in interface StepwiseAlgorithm
See Also:
StepwiseAlgorithm.previousStep()

finished

public boolean finished()
Specified by:
finished in interface StepwiseAlgorithm
Returns:
true iff the algorithm has terminated.

atStart

public boolean atStart()
Specified by:
atStart in interface StepwiseAlgorithm
Returns:
true iff the algorithm is in its starting state.