org.hypergraphdb.algorithms
Interface HGALGenerator

All Known Implementing Classes:
DefaultALGenerator, SimpleALGenerator

public interface HGALGenerator

This interface defines an adjency list (AL) generator. An AL generator is capable of producing all atoms adjacent to a given atom. Because with HyperGraphDB, a single link can be the source of several adjacent atoms, and moreover two atoms may be adjacent through more that one link, one needs both the link and the target atom when enumerating the neighborhood of a given atom. The HGAlGenerator inteface provides both those pieces of information. All target atoms are streamed in the iterator returned by the generate method. At each call to next of that iterator, a given link to the atom of interest is being examined. This link's atom handle is returned by the getCurrentLink method.

Note that because two atoms may be linked in more than way, it is possible for the iterator returned by generate to produce the same target atom more than once. Usually however, an HGALGenerator implementation will consider only links of interest in a particular context and such duplication will not occur.

The order in which the atoms are produced may or may not be important for the particular algorithm being applied, but a graph traversal takes that order into consideration simply in virtue of its implementation. Hence, an AL generator, when used in combination with a graph traversal, may rely on the fact that atoms will be explored in order.

Note that AL generators return the atoms in the form of a HGSearchResult which may or may not contain references to external resources (such as database cursors). As all HGSearchResult instances, they must be closed in all situation (normal or exceptional) after one is done with them.

Author:
Borislav Iordanov

Method Summary
 HGSearchResult<HGHandle> generate(HGHandle h)
           Return an Iterator over all atoms adjacent to the passed in atom.
 HGHandle getCurrentLink()
          Return the HGHandle of the currently examined link.
 

Method Detail

getCurrentLink

HGHandle getCurrentLink()

Return the HGHandle of the currently examined link.


generate

HGSearchResult<HGHandle> generate(HGHandle h)

Return an Iterator over all atoms adjacent to the passed in atom.

Parameters:
h - The handle of the atom of interest.