public class HGBreadthFirstTraversal extends Object implements HGTraversal
Implements a breadth-first search of a graph. As a reminder, breadth-first will visit all atoms in an adjacency list before exploring their adjacent atoms in turn.
Constructor and Description |
---|
HGBreadthFirstTraversal() |
HGBreadthFirstTraversal(HGHandle startAtom,
HGALGenerator adjListGenerator) |
HGBreadthFirstTraversal(HGHandle startAtom,
HGALGenerator adjListGenerator,
int maxDistance) |
HGBreadthFirstTraversal(Ref<HGHandle> startAtom,
HGALGenerator adjListGenerator) |
HGBreadthFirstTraversal(Ref<HGHandle> startAtom,
HGALGenerator adjListGenerator,
int maxDistance) |
Modifier and Type | Method and Description |
---|---|
HGALGenerator |
getAdjListGenerator() |
HGHandle |
getStartAtom() |
Ref<HGHandle> |
getStartAtomReference() |
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.
|
void |
remove() |
void |
reset() |
void |
setAdjListGenerator(HGALGenerator adjListGenerator) |
void |
setStartAtom(HGHandle startAtom) |
void |
setStartAtomReference(Ref<HGHandle> startAtom) |
public HGBreadthFirstTraversal()
public HGBreadthFirstTraversal(HGHandle startAtom, HGALGenerator adjListGenerator)
public HGBreadthFirstTraversal(Ref<HGHandle> startAtom, HGALGenerator adjListGenerator)
public HGBreadthFirstTraversal(HGHandle startAtom, HGALGenerator adjListGenerator, int maxDistance)
public HGBreadthFirstTraversal(Ref<HGHandle> startAtom, HGALGenerator adjListGenerator, int maxDistance)
public void setStartAtom(HGHandle startAtom)
public HGHandle getStartAtom()
public HGALGenerator getAdjListGenerator()
public void setAdjListGenerator(HGALGenerator adjListGenerator)
public boolean hasNext()
HGTraversal
Return true
if there are remaining atoms to be visited and
false
otherwise.
public boolean isVisited(HGHandle handle)
HGTraversal
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.
isVisited
in interface HGTraversal
handle
- The handle of the atom.public Pair<HGHandle,HGHandle> next()
HGTraversal
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>.
public void reset()
Copyright © 2015. All rights reserved.