PGROUTING  3.2
pgrouting::functions::Pgr_Bipartite< G > Class Template Reference

#include "pgr_bipartite_driver.hpp"

Inheritance diagram for pgrouting::functions::Pgr_Bipartite< G >:
Collaboration diagram for pgrouting::functions::Pgr_Bipartite< G >:

Public Types

typedef G::V_i V_i
 

Public Member Functions

void clear ()
 clear More...
 
std::string get_error () const
 get_error More...
 
std::string get_log () const
 get_log More...
 
std::string get_notice () const
 get_notice More...
 
bool has_error () const
 get_error More...
 
std::vector< pgr_bipartite_rtpgr_bipartite (G &graph)
 
std::vector< pgr_bipartite_rtprint_Bipartite (G &graph)
 

Public Attributes

std::ostringstream error
 Stores the error information. More...
 
std::ostringstream log
 Stores the hint information. More...
 
std::ostringstream notice
 Stores the notice information. More...
 

Detailed Description

template<class G>
class pgrouting::functions::Pgr_Bipartite< G >

Definition at line 53 of file pgr_bipartite_driver.hpp.

Member Typedef Documentation

◆ V_i

template<class G >
typedef G::V_i pgrouting::functions::Pgr_Bipartite< G >::V_i

Definition at line 55 of file pgr_bipartite_driver.hpp.

Member Function Documentation

◆ clear()

void pgrouting::Pgr_messages::clear ( )
inherited

clear

Clears All the messages

Definition at line 59 of file pgr_messages.cpp.

59  {
60  log.str("");
61  log.clear();
62 
63  notice.str("");
64  notice.clear();
65 
66  error.str("");
67  error.clear();
68 }

References pgrouting::Pgr_messages::error, pgrouting::Pgr_messages::log, and pgrouting::Pgr_messages::notice.

Referenced by do_pgr_pickDeliver().

◆ get_error()

std::string pgrouting::Pgr_messages::get_error ( ) const
inherited

get_error

Returns
the current contents of the log and clears the log

Definition at line 53 of file pgr_messages.cpp.

53  {
54  auto str = error.str();
55  return str;
56 }

References pgrouting::Pgr_messages::error.

Referenced by do_pgr_many_withPointsDD(), do_pgr_pickDeliver(), do_pgr_pickDeliverEuclidean(), do_pgr_withPoints(), do_pgr_withPointsKsp(), and pgrouting::vrp::Pgr_pickDeliver::Pgr_pickDeliver().

◆ get_log()

std::string pgrouting::Pgr_messages::get_log ( ) const
inherited

◆ get_notice()

std::string pgrouting::Pgr_messages::get_notice ( ) const
inherited

get_notice

Returns
the current contents of the log and clears the log

Definition at line 42 of file pgr_messages.cpp.

42  {
43  auto str = notice.str();
44  return str;
45 }

References pgrouting::Pgr_messages::notice.

◆ has_error()

bool pgrouting::Pgr_messages::has_error ( ) const
inherited

get_error

Returns
the current contents of the log and clears the log

Definition at line 48 of file pgr_messages.cpp.

48  {
49  return !error.str().empty();
50 }

References pgrouting::Pgr_messages::error.

Referenced by do_pgr_many_withPointsDD(), do_pgr_withPoints(), and do_pgr_withPointsKsp().

◆ pgr_bipartite()

template<class G >
std::vector<pgr_bipartite_rt> pgrouting::functions::Pgr_Bipartite< G >::pgr_bipartite ( G &  graph)
inline

Definition at line 85 of file pgr_bipartite_driver.hpp.

86  {
87  std::vector<pgr_bipartite_rt> results;
88  bool bipartite = boost::is_bipartite(graph.graph);
89  if (bipartite) results = print_Bipartite(graph);
90  return results;
91  }

Referenced by do_pgr_bipartite().

◆ print_Bipartite()

template<class G >
std::vector<pgr_bipartite_rt> pgrouting::functions::Pgr_Bipartite< G >::print_Bipartite ( G &  graph)
inline

Definition at line 56 of file pgr_bipartite_driver.hpp.

57  {
58  std::vector<pgr_bipartite_rt> results;
59  std::vector <boost::default_color_type> partition(graph.num_vertices());
60  auto partition_map =
61  make_iterator_property_map(partition.begin(), boost::get(boost::vertex_index, graph.graph));
62 
63  /* abort in case of an interruption occurs (e.g. the query is being cancelled) */
64  CHECK_FOR_INTERRUPTS();
65  try {
66  boost::is_bipartite(graph.graph, boost::get(boost::vertex_index, graph.graph), partition_map);
67  } catch (boost::exception const& ex) {
68  (void)ex;
69  throw;
70  } catch (std::exception &e) {
71  (void)e;
72  throw;
73  } catch (...) {
74  throw;
75  }
76  V_i v, vend;
77  for (boost::tie(v, vend) = vertices(graph.graph); v != vend; ++v) {
78  int64_t vid = graph[*v].id;
79  boost::get(partition_map, *v) ==
80  boost::color_traits <boost::default_color_type>::white() ?
81  results.push_back({vid, 0}) :results.push_back({vid, 1});
82  }
83  return results;
84  }

Member Data Documentation

◆ error

◆ log

◆ notice

std::ostringstream pgrouting::Pgr_messages::notice
mutableinherited

Stores the notice information.

Definition at line 83 of file pgr_messages.h.

Referenced by pgrouting::Pgr_messages::clear(), and pgrouting::Pgr_messages::get_notice().


The documentation for this class was generated from the following file:
pgrouting::functions::Pgr_Bipartite::V_i
G::V_i V_i
Definition: pgr_bipartite_driver.hpp:55
pgrouting::Pgr_messages::error
std::ostringstream error
Stores the error information.
Definition: pgr_messages.h:85
pgrouting::Pgr_messages::log
std::ostringstream log
Stores the hint information.
Definition: pgr_messages.h:81
pgrouting::Pgr_messages::notice
std::ostringstream notice
Stores the notice information.
Definition: pgr_messages.h:83
pgrouting::functions::Pgr_Bipartite::print_Bipartite
std::vector< pgr_bipartite_rt > print_Bipartite(G &graph)
Definition: pgr_bipartite_driver.hpp:56