PGROUTING  3.2
Pgr_stoerWagner< G > Class Template Reference

#include "pgr_stoerWagner.hpp"

Public Types

typedef G::E E
 
typedef G::E_i E_i
 
typedef G::V V
 

Public Member Functions

std::vector< pgr_stoerWagner_tstoerWagner (G &graph)
 

Private Member Functions

std::vector< pgr_stoerWagner_tgeneratestoerWagner (const G &graph)
 

Detailed Description

template<class G>
class Pgr_stoerWagner< G >

Definition at line 50 of file pgr_stoerWagner.hpp.

Member Typedef Documentation

◆ E

template<class G >
typedef G::E Pgr_stoerWagner< G >::E

Definition at line 60 of file pgr_stoerWagner.hpp.

◆ E_i

template<class G >
typedef G::E_i Pgr_stoerWagner< G >::E_i

Definition at line 61 of file pgr_stoerWagner.hpp.

◆ V

template<class G >
typedef G::V Pgr_stoerWagner< G >::V

Definition at line 59 of file pgr_stoerWagner.hpp.

Member Function Documentation

◆ generatestoerWagner()

template<class G >
std::vector< pgr_stoerWagner_t > Pgr_stoerWagner< G >::generatestoerWagner ( const G &  graph)
inlineprivate

Definition at line 68 of file pgr_stoerWagner.hpp.

69  {
70  std::vector< pgr_stoerWagner_t > results;
71  auto parities = boost::make_one_bit_color_map(
72  num_vertices(graph.graph),
73  get(boost::vertex_index, graph.graph));
74 
75  double w = stoer_wagner_min_cut(
76  graph.graph,
77  get(&G::G_T_E::cost, graph.graph),
78  boost::parity_map(parities));
79 
80  double totalcost = 0;
81  E_i ei, ei_end;
82  for (boost::tie(ei, ei_end) = edges(graph.graph); ei != ei_end; ei++) {
83  auto s = source(*ei, graph.graph);
84  auto t = target(*ei, graph.graph);
85 
86  if (get(parities, s) != get(parities, t)) {
88 
89  tmp.cost = graph[*ei].cost;
90 
91  auto edge_id =
92  graph.get_edge_id(
93  source(*ei, graph.graph),
94  target(*ei, graph.graph),
95  tmp.cost);
96 
97  tmp.edge = edge_id;
98  totalcost += tmp.cost;
99  tmp.mincut = totalcost;
100  results.push_back(tmp);
101  }
102  }
103 
104  pgassert(w == totalcost);
105  return results;
106  }

References pgr_stoerWagner_t::cost, pgr_stoerWagner_t::edge, pgr_stoerWagner_t::mincut, and pgassert.

◆ stoerWagner()

template<class G >
std::vector< pgr_stoerWagner_t > Pgr_stoerWagner< G >::stoerWagner ( G &  graph)

Definition at line 111 of file pgr_stoerWagner.hpp.

112  {
113  pgassert(num_vertices(graph.graph) > 1);
114  return generatestoerWagner(
115  graph);
116 }

References pgassert.

Referenced by pgr_stoerWagner().


The documentation for this class was generated from the following file:
pgr_stoerWagner_t::edge
int64_t edge
Definition: pgr_stoerWagner_t.h:38
Pgr_stoerWagner::generatestoerWagner
std::vector< pgr_stoerWagner_t > generatestoerWagner(const G &graph)
Definition: pgr_stoerWagner.hpp:68
pgr_stoerWagner_t
Definition: pgr_stoerWagner_t.h:36
pgassert
#define pgassert(expr)
Uses the standard assert syntax.
Definition: pgr_assert.h:94
Pgr_stoerWagner::E_i
G::E_i E_i
Definition: pgr_stoerWagner.hpp:61
pgr_stoerWagner_t::mincut
double mincut
Definition: pgr_stoerWagner_t.h:40
pgr_stoerWagner_t::cost
double cost
Definition: pgr_stoerWagner_t.h:39