In accordance to Graph documentation, API allows following iteration methods:
Whenever a node is visited, a visit method of UnweightedGraphVertexVisitor or WeightedGraphVertexVisitor instance (depending on type of graph used), already provided to function as argument, is executed. If it returns true iteration continues, otherwise it stops. Since UnweightedGraphVertexVisitor or WeightedGraphVertexVisitor is an interface, end users will need to provide an implementation for it.
Function that implements breadth-first-search traversal for Unweighted Graph from start vertex
template <typename T, int (*compare)(const T&, const T&) = comparator<T>, std::size_t (*hash)(const T&) = hash<T>>
inline void BreadthFirstSearchGraphIterator(UnweightedGraphVertex<T, compare, hash>* const& vertex, UnweightedGraphVertexVisitor<T, compare, hash>* const& visitor)
Function that implements breadth-first-search traversal for Weighted Graph from start vertex
template <typename T, typename W, int (*compare)(const T&, const T&) = comparator<T>, std::size_t (*hash)(const T&) = hash<T>>
inline void BreadthFirstSearchGraphIterator(WeightedGraphVertex<T,W,compare,hash>* vertex, WeightedGraphVertexVisitor<T,W,compare,hash>* visitor)
Function that implements depth-first-search traversal for Unweighted Graph from start vertex
template <typename T, int (*compare)(const T&, const T&) = comparator<T>, std::size_t (*hash)(const T&) = hash<T>>
inline void DepthFirstSearchGraphIterator(UnweightedGraphVertex<T, compare, hash>* const& vertex, UnweightedGraphVertexVisitor<T, compare, hash>* const& visitor)
Function that implements depth-first-search traversal for Weighted Graph from start vertex
template <typename T, typename W, int (*compare)(const T&, const T&) = comparator<T>, std::size_t (*hash)(const T&) = hash<T>>
inline void DepthFirstSearchGraphIterator(WeightedGraphVertex<T,W,compare,hash>* vertex, WeightedGraphVertexVisitor<T,W,compare,hash>* visitor)
Abstract class implementing blueprints for vertex visitation during Unweighted Graph traversal
template <typename T, int (*compare)(const T&, const T&) = comparator<T>, std::size_t (*hash)(const T&) = hash<T>>
class UnweightedGraphVertexVisitor
Method | Signature | Description |
~UnweightedGraphVertexVisitor | virtual ~UnweightedGraphVertexVisitor () | Deallocates all data from heap memory |
visit | virtual bool visit (UnweightedGraphVertex<T, compare, hash>* const& element, UnweightedGraphVertex<T, compare, hash>* const& parent) = 0 | Visits a vertex during iteration. If false is returned, iteration stops! |
isVisited | virtual bool isVisited (UnweightedGraphVertex<T, compare, hash>* const& element) = 0 | Checks if a vertex has already been visited |
Abstract class implementing blueprints for vertex visitation during Weighted Graph traversal
template <typename T, typename W, int (*compare)(const T&, const T&) = comparator<T>, std::size_t (*hash)(const T&) = hash<T>>
class WeightedGraphVertexVisitor
Method | Signature | Description |
~WeightedGraphVertexVisitor | virtual ~WeightedGraphVertexVisitor () { | Deallocates all data from heap memory |
visit | virtual bool visit (WeightedGraphVertex<T, W, compare, hash>* const& element, WeightedGraphVertex<T, W, compare, hash>* const& parent) = 0 | Visits a vertex during iteration. If false is returned, iteration stops! |
isVisited | virtual bool isVisited (WeightedGraphVertex<T, W, compare, hash>* const& element) = 0 | Checks if a vertex has already been visited |