source: src/Graph/BreadthFirstSearchGatherer.hpp@ 9b5fa6

ForceAnnealing_oldresults IndependentFragmentGrids_IntegrationTest
Last change on this file since 9b5fa6 was 9b5fa6, checked in by Frederik Heber <frederik.heber@…>, 8 years ago

Extended BreadthFirstSearchGatherer to allow BFS with limited discovery horizon.

  • TESTS: extended unit test as well.
  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 * BreadthFirstSearchGatherer.hpp
3 *
4 * Created on: May 17, 2017
5 * Author: heber
6 */
7
8
9#ifndef GRAPH_BREADTHFIRSTSEARCHGATHERER_HPP_
10#define GRAPH_BREADTHFIRSTSEARCHGATHERER_HPP_
11
12// include config.h
13#ifdef HAVE_CONFIG_H
14#include <config.h>
15#endif
16
17#include <stddef.h>
18#include <vector>
19
20#include "types.hpp"
21
22struct BoostGraphCreator;
23
24/** This struct performs a BFS on a given boost::graph and finds
25 * all nodes, i.e. atoms, up to a given limit.
26 */
27struct BreadthFirstSearchGatherer
28{
29 /** Cstor of class BreadthFirstSearchGatherer.
30 *
31 * \param _graph graph to work on
32 */
33 BreadthFirstSearchGatherer(BoostGraphCreator &_graph);
34
35 /** Discovers all nodes from the given \a _discoverfrom and returns
36 * the vector of ids.
37 *
38 * \param _discoverfrom node to start BFS from
39 * \param _max_distance max distance to discover (negative means all)
40 */
41 std::vector<atomId_t> operator()(
42 const atomId_t &_discoverfrom,
43 const int &_max_distance = -1);
44
45private:
46 //!> typedef for a vector with BFS discovery distances
47 typedef std::vector<size_t> distances_t;
48
49 //!> graph to operate on
50 BoostGraphCreator &BGcreator;
51};
52
53
54#endif /* GRAPH_BREADTHFIRSTSEARCHGATHERER_HPP_ */
Note: See TracBrowser for help on using the repository browser.