The following code (Snippet 1) compiles fine:
#include <boost/config.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/boykov_kolmogorov_max_flow.hpp>
#include <boost/graph/graph_utility.hpp>
using namespace boost;
typedef adjacency_list_traits<vecS, vecS, directedS> Traits_vvd;
typedef adjacency_list_traits<vecS, vecS, undirectedS> Traits_vvu;
typedef adjacency_list<
vecS, vecS, directedS,
property<
vertex_index_t, int,
property<vertex_color_t, boost::default_color_type,
property<vertex_distance_t, double,
property<vertex_predecessor_t, Traits_vvd::edge_descriptor>
> > >,
property<
edge_index_t, int,
property<edge_capacity_t, double,
property<edge_weight_t, double,
property<edge_residual_capacity_t, double,
property<edge_reverse_t, Traits_vvd::edge_descriptor>
> > > > >
Graph_vvd;
class MAXFLOW_ {
public:
double solve_max_flow(int s, int t){
double retval = boykov_kolmogorov_max_flow(g, s, t);
return retval;
}
private:
Graph_vvd g;
};
int main(){
return 0;
}
However, on removing vertex_distance_t
and vertex_predecessor_t
from the graph, we have this code (Snippet 2) that fails to compile:
#include <boost/config.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/boykov_kolmogorov_max_flow.hpp>
#include <boost/graph/graph_utility.hpp>
using namespace boost;
typedef adjacency_list_traits<vecS, vecS, directedS> Traits_vvd;
typedef adjacency_list_traits<vecS, vecS, undirectedS> Traits_vvu;
typedef adjacency_list<
vecS, vecS, directedS,
property<
vertex_index_t, int,
property<vertex_color_t, boost::default_color_type
> >,
property<
edge_index_t, int,
property<edge_capacity_t, double,
property<edge_weight_t, double,
property<edge_residual_capacity_t, double,
property<edge_reverse_t, Traits_vvd::edge_descriptor>
> > > > >
Graph_vvd;
class MAXFLOW_ {
public:
double solve_max_flow(int s, int t){
double retval = boykov_kolmogorov_max_flow(g, s, t);
return retval;
}
private:
Graph_vvd g;
};
int main(){
return 0;
}
The only difference between Snippet 1 and Snippet 2 is that in the second, there are no vertex properties related to vertex_distance_t
and vertex_predecessor_t
.
My questions are:
(1) The compilation errors here are unintelligible to me. Is there a way to begin to make sense of the errors and subsequently figure out that one has missed specifying the required properties for proper functioning of the algorithm, in this case algorithm to find the max flow using boykov_kolmogorov method?
(2) On going through the code example provided in boost documentation for this algorithm, available here, indeed the vertices have the required properties:
property < vertex_name_t, std::string,
property < vertex_index_t, long,
property < vertex_color_t, boost::default_color_type,
property < vertex_distance_t, long,
property < vertex_predecessor_t, Traits::edge_descriptor > > > > >,
But this code also has some unnecessary properties such as vertex_name_t
without which Snippet 1 compiled just fine. Is there a way to figure out the bare minimal set of properties to specify for proper functioning of boost algorithms?