HavoqGT
havoqgt::mpi::bfs_visitor< Graph, LevelData, ParentData > Class Template Reference

#include <breadth_first_search.hpp>

Public Types

typedef Graph::vertex_locator vertex_locator
 

Public Member Functions

 bfs_visitor ()
 
 bfs_visitor (vertex_locator _vertex, uint64_t _level, vertex_locator _parent)
 
 bfs_visitor (vertex_locator _vertex)
 
bool pre_visit () const
 
template<typename VisitorQueueHandle >
bool visit (Graph &g, VisitorQueueHandle vis_queue) const
 
uint64_t level () const
 
vertex_locator parent () const
 

Static Public Member Functions

static void set_level_data (LevelData *_data)
 
static LevelData *& level_data ()
 
static void set_parent_data (ParentData *_data)
 
static ParentData *& parent_data ()
 

Public Attributes

vertex_locator vertex
 
vertex_locator m_parent
 
uint64_t m_level: 8
 

Friends

bool operator> (const bfs_visitor &v1, const bfs_visitor &v2)
 

Detailed Description

template<typename Graph, typename LevelData, typename ParentData>
class havoqgt::mpi::bfs_visitor< Graph, LevelData, ParentData >

Definition at line 170 of file breadth_first_search.hpp.

Member Typedef Documentation

template<typename Graph, typename LevelData, typename ParentData>
typedef Graph::vertex_locator havoqgt::mpi::bfs_visitor< Graph, LevelData, ParentData >::vertex_locator

Definition at line 172 of file breadth_first_search.hpp.

Constructor & Destructor Documentation

template<typename Graph, typename LevelData, typename ParentData>
havoqgt::mpi::bfs_visitor< Graph, LevelData, ParentData >::bfs_visitor ( )
inline

Definition at line 173 of file breadth_first_search.hpp.

173 : m_level(std::numeric_limits<uint64_t>::max()) { }
template<typename Graph, typename LevelData, typename ParentData>
havoqgt::mpi::bfs_visitor< Graph, LevelData, ParentData >::bfs_visitor ( vertex_locator  _vertex,
uint64_t  _level,
vertex_locator  _parent 
)
inline

Definition at line 174 of file breadth_first_search.hpp.

175  : vertex(_vertex)
176  , m_parent(_parent)
177  , m_level(_level) { }
template<typename Graph, typename LevelData, typename ParentData>
havoqgt::mpi::bfs_visitor< Graph, LevelData, ParentData >::bfs_visitor ( vertex_locator  _vertex)
inline

Definition at line 179 of file breadth_first_search.hpp.

180  : vertex(_vertex)
181  , m_parent(_vertex)
182  , m_level(0) { }

Member Function Documentation

template<typename Graph, typename LevelData, typename ParentData>
uint64_t havoqgt::mpi::bfs_visitor< Graph, LevelData, ParentData >::level ( ) const
inline

Definition at line 212 of file breadth_first_search.hpp.

212 { return m_level; }

Here is the caller graph for this function:

template<typename Graph, typename LevelData, typename ParentData>
static LevelData*& havoqgt::mpi::bfs_visitor< Graph, LevelData, ParentData >::level_data ( )
inlinestatic

Definition at line 233 of file breadth_first_search.hpp.

233  {
234  static LevelData* data;
235  return data;
236  }

Here is the caller graph for this function:

template<typename Graph, typename LevelData, typename ParentData>
vertex_locator havoqgt::mpi::bfs_visitor< Graph, LevelData, ParentData >::parent ( ) const
inline

Definition at line 213 of file breadth_first_search.hpp.

213 { return m_parent; }

Here is the caller graph for this function:

template<typename Graph, typename LevelData, typename ParentData>
static ParentData*& havoqgt::mpi::bfs_visitor< Graph, LevelData, ParentData >::parent_data ( )
inlinestatic

Definition at line 239 of file breadth_first_search.hpp.

239  {
240  static ParentData* data;
241  return data;
242  }

Here is the caller graph for this function:

template<typename Graph, typename LevelData, typename ParentData>
bool havoqgt::mpi::bfs_visitor< Graph, LevelData, ParentData >::pre_visit ( ) const
inline

Definition at line 185 of file breadth_first_search.hpp.

185  {
186  bool do_visit = (*level_data())[vertex] > level();
187  if(do_visit) {
188  (*level_data())[vertex] = level();
189  }
190  return do_visit;
191  }
static LevelData *& level_data()

Here is the call graph for this function:

template<typename Graph, typename LevelData, typename ParentData>
static void havoqgt::mpi::bfs_visitor< Graph, LevelData, ParentData >::set_level_data ( LevelData *  _data)
inlinestatic

Definition at line 231 of file breadth_first_search.hpp.

231 { level_data() = _data; }
static LevelData *& level_data()

Here is the call graph for this function:

template<typename Graph, typename LevelData, typename ParentData>
static void havoqgt::mpi::bfs_visitor< Graph, LevelData, ParentData >::set_parent_data ( ParentData *  _data)
inlinestatic

Definition at line 238 of file breadth_first_search.hpp.

238 { parent_data() = _data; }
static ParentData *& parent_data()

Here is the call graph for this function:

template<typename Graph, typename LevelData, typename ParentData>
template<typename VisitorQueueHandle >
bool havoqgt::mpi::bfs_visitor< Graph, LevelData, ParentData >::visit ( Graph &  g,
VisitorQueueHandle  vis_queue 
) const
inline

Definition at line 194 of file breadth_first_search.hpp.

194  {
195  if(level() <= (*level_data())[vertex]) {
196  (*level_data())[vertex] = level();
197  (*parent_data())[vertex] = parent();
198 
199  typedef typename Graph::edge_iterator eitr_type;
200  for(eitr_type eitr = g.edges_begin(vertex); eitr != g.edges_end(vertex); ++eitr) {
201  vertex_locator neighbor = eitr.target();
202  //std::cout << "Visiting neighbor: " << g.locator_to_label(neighbor) << std::endl;
203  bfs_visitor new_visitor(neighbor, level() + 1,
204  vertex);
205  vis_queue->queue_visitor(new_visitor);
206  }
207  return true;
208  }
209  return false;
210  }
static LevelData *& level_data()
static ParentData *& parent_data()
Graph::vertex_locator vertex_locator
vertex_locator parent() const

Here is the call graph for this function:

Friends And Related Function Documentation

template<typename Graph, typename LevelData, typename ParentData>
bool operator> ( const bfs_visitor< Graph, LevelData, ParentData > &  v1,
const bfs_visitor< Graph, LevelData, ParentData > &  v2 
)
friend

Definition at line 215 of file breadth_first_search.hpp.

215  {
216  //return v1.level() > v2.level();
217  if(v1.level() > v2.level())
218  {
219  return true;
220  } else if(v1.level() < v2.level())
221  {
222  return false;
223  }
224  return !(v1.vertex < v2.vertex);
225  }

Member Data Documentation

template<typename Graph, typename LevelData, typename ParentData>
uint64_t havoqgt::mpi::bfs_visitor< Graph, LevelData, ParentData >::m_level

Definition at line 246 of file breadth_first_search.hpp.

template<typename Graph, typename LevelData, typename ParentData>
vertex_locator havoqgt::mpi::bfs_visitor< Graph, LevelData, ParentData >::m_parent

Definition at line 245 of file breadth_first_search.hpp.

template<typename Graph, typename LevelData, typename ParentData>
vertex_locator havoqgt::mpi::bfs_visitor< Graph, LevelData, ParentData >::vertex

Definition at line 243 of file breadth_first_search.hpp.


The documentation for this class was generated from the following file: