|
![]() SandMark version 3.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--sandmark.util.graph.Bfs
| Field Summary | |
(package private) static int |
BLACK
|
(package private) java.util.Iterator |
edgeIter
|
(package private) Graph |
graph
|
(package private) static int |
GRAY
|
(package private) boolean |
hasNextPath
|
(package private) Path |
nextPath
|
(package private) java.util.HashMap |
parent
|
(package private) java.util.ArrayList |
queue
|
(package private) static int |
WHITE
|
| Constructor Summary | |
Bfs(Graph graph,
Node root)
Perform a breadth-first-search on a graph from a particular root node.
|
|
| 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 |
static final int WHITE
static final int GRAY
static final int BLACK
java.util.ArrayList queue
Graph graph
java.util.Iterator edgeIter
Path nextPath
boolean hasNextPath
java.util.HashMap parent
| Constructor Detail |
public Bfs(Graph graph,
Node root)
root node.
Bfs d = new Bfs(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.
graph - the graphroot - the root node from which we start exploring.| Method Detail |
public boolean hasNext()
hasNext in interface java.util.Iteratorpublic java.lang.Object next()
next in interface java.util.Iteratorpublic void remove()
remove in interface java.util.Iteratorpublic static void main(java.lang.String[] args)
|
SandMark version 3.0 Wed Jan 29 10:30:05 MST 2003 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||