public interface HGTraversal extends Iterator<Pair<HGHandle,HGHandle>>
This interface represents a generic graph traversal. Concrete traversals, reflecting variations in the order of visiting and of the filtering of the nodes are implemented to suit various graph related algorithms.
Traversal can be used either in the implementation graph algorithms, such as finding the shortest path between two atoms, or as the underlying result sets of certain queries. Because of this commonality, traversals are driven "by the outside", instead of doing the actual work of visiting through a callback mechanism. Nevertheless, concrete traversals may expose some form of callbacks for various events during the traversal, or expose the internal state of the process.
It should be quite possible to implement the traversals as bidirectional (i.e. with
hasPrev
and prev
methods defined) should a real need arise.
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext()
Return
true if there are remaining atoms to be visited and
false otherwise. |
boolean |
isVisited(HGHandle handle)
Return
true if the given atom was already visited and
false otherwise. |
Pair<HGHandle,HGHandle> |
next()
Return a pair consisting of the link pointing to the next atom in the
traversal as well as the atom itself.
|
boolean hasNext()
Return true
if there are remaining atoms to be visited and
false
otherwise.
Pair<HGHandle,HGHandle> next()
Return a pair consisting of the link pointing to the next atom in the traversal as well as the atom itself. That is, return a Pair<handle to link, handle to target atom>.
boolean isVisited(HGHandle handle)
Return true
if the given atom was already visited and
false
otherwise.
An atom is considered visited as soon as it is returned by a call to the
next
method, and not before.
handle
- The handle of the atom.Copyright © 2015. All rights reserved.