/* * BreadthFirstSearchAdd.hpp * * Created on: Feb 16, 2011 * Author: heber */ #ifndef BREADTHFIRSTSEARCHADD_HPP_ #define BREADTHFIRSTSEARCHADD_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include #include "Bond/GraphEdge.hpp" #include "Helpers/defs.hpp" #include "types.hpp" class atom; class bond; class molecule; class BreadthFirstSearchAdd { public: BreadthFirstSearchAdd(atom *&_Root, int _BondOrder, bool _IsAngstroem); ~BreadthFirstSearchAdd(); /** Reinitializes the structure for a new BFS run. * * @param _Root Root atom to start BFS from * @param _BondOrder horizon in bond counts when to stop BFS */ void Init(atom *&_Root, int _BondOrder); /** Adds atoms up to \a BondCount distance from \a *Root and notes them down in \a AddedAtomList. * Gray vertices are always enqueued in an std::deque FIFO queue, the rest is usual BFS with adding vertices found was * white and putting into queue. * \param *Mol Molecule class to add atoms to * \param *Root root vertex for BFS * \param *Bond bond not to look beyond * \param BondOrder maximum distance for vertices to add * \param IsAngstroem lengths are in angstroem or bohrradii */ void operator()(molecule *Mol, atom *_Root, bond *Bond, int _BondOrder); private: void UnvisitedNode(molecule *Mol, atom *&Walker, atom *&OtherAtom, bond *&Binder, bond *&Bond); void VisitedNode(molecule *Mol, atom *&Walker, atom *&OtherAtom, bond *&Binder, bond *&Bond); /** initialise vertex as white with no predecessor, empty queue, color Root lightgray. * */ void InitNode(atomId_t atom_id); std::map PredecessorList; std::map ShortestPathList; std::map ColorList; std::deque BFSStack; int BondOrder; atom *Root; bool BackStepping; int CurrentGraphNr; int ComponentNr; std::map AddedAtomList; std::map AddedBondList; bool IsAngstroem; }; #endif /* BREADTHFIRSTSEARCHADD_HPP_ */