The Octet Molecular Representation Framework v0.8.2

net.sf.octet.traversal
Interface BreadthTraverser

All Known Implementing Classes:
BasicBreadthTraverser

public interface BreadthTraverser

Traverses an AtomGraph in breadth first order starting from a client-defined root Atom. In a connected AtomGraph, BreadthTraverser traverses each Atom and AtomPair at least once. Traversal proceeds via layers of Atoms that are equidistant from the root Atom. Traversal events follow the ordering:

  1. layerStarted is called.
  2. The root Atom is traversed (atomTraversed).
  3. layerFinished is called
  4. layerStarted is called. An AtomPair linking the root Atom to one of its neighbors is traversed, followed by the neighboring Atom. If the neighboring Atom has already been traversed, only the AtomPair is traversed. Such a condition indicates the presence of a cycle with an even number of Atoms.
  5. Any AtomPairs connecting two Atoms in the current layer are traversed. Notification proceeds through Handler.crossAtomPairTraversed and not Handler.atomPairTraversed.

Using BreadthTraverser consists of providing an AtomGraph , a root Atom, and an implementation of the BreadthTraverser.Handler interface to the traverse method. The handler will be notified of various stages in the traversal.

Author:
Richard Apodaca

Nested Class Summary
static interface BreadthTraverser.Handler
          An extension of the TraversalHandler interface that includes methods specific to BreadthTraverser traversal.
 
Method Summary
 void traverse(AtomGraph graph, Atom root, BreadthTraverser.Handler handler)
          Traverses graph staring from root, while notifying handler of traversal events.
 

Method Detail

traverse

public void traverse(AtomGraph graph,
                     Atom root,
                     BreadthTraverser.Handler handler)
Traverses graph staring from root, while notifying handler of traversal events.

Parameters:
graph - the AtomGraph to traverse
root - the root Atom
handler - receives traversal events

The Octet Molecular Representation Framework v0.8.2