public class HGDepthFirstTraversal extends Object implements HGTraversal
Implements a depth-first search of a graph. As a reminder, depth-first will visit atoms adjacent to the current before visiting its siblings.
Constructor and Description |
---|
HGDepthFirstTraversal() |
HGDepthFirstTraversal(HGHandle startAtom,
HGALGenerator adjListGenerator) |
HGDepthFirstTraversal(Ref<HGHandle> startAtom,
HGALGenerator adjListGenerator) |
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 HGDepthFirstTraversal()
public HGDepthFirstTraversal(HGHandle startAtom, HGALGenerator adjListGenerator)
public HGDepthFirstTraversal(Ref<HGHandle> startAtom, HGALGenerator adjListGenerator)
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 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 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 void reset()
Copyright © 2015. All rights reserved.