SandMark version 3.0


sandmark.util.graph
Class Afs

java.lang.Object
  |
  +--sandmark.util.graph.Afs
All Implemented Interfaces:
java.util.Iterator
Direct Known Subclasses:
AllPathsIterator.Afs

public class Afs
extends java.lang.Object
implements java.util.Iterator


Field Summary
(package private)  java.util.Iterator edgeIter
           
(package private)  Graph graph
           
(package private)  boolean hasNextPath
           
(package private)  Path nextPath
           
(package private)  java.util.HashMap parent
           
(package private)  java.util.ArrayList queue
           
(package private)  java.util.HashSet seen
           
 
Constructor Summary
Afs(Graph graph, Node root)
          Perform a breadth-first-search on a graph from a particular root node, generating all paths.
 
Method Summary
 boolean hasNext()
           
static void main(java.lang.String[] args)
           
 java.lang.Object next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

queue

java.util.ArrayList queue

graph

Graph graph

edgeIter

java.util.Iterator edgeIter

nextPath

Path nextPath

hasNextPath

boolean hasNextPath

parent

java.util.HashMap parent

seen

java.util.HashSet seen
Constructor Detail

Afs

public Afs(Graph graph,
           Node root)
Perform a breadth-first-search on a graph from a particular root node, generating all paths.
    Afs d = new Afs(graph,root);
    while (d.hasNext()) {
       sandmark.util.graph.Path path = (sandmark.util.graph.Path) d.next();
    }
 

We generate a set of paths, where path[0]==root and path[path.length-1] is the node we're currently visiting.

Parameters:
graph - the graph
root - the root node from which we start exploring.
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
Specified by:
next in interface java.util.Iterator

remove

public void remove()
Specified by:
remove in interface java.util.Iterator

main

public static void main(java.lang.String[] args)

SandMark version 3.0

Wed Jan 29 10:30:05 MST 2003