I made a super simple example: A graph with 2 nodes and an edge between them. On trying to call kolmogorov_max_flow, I am getting:
error: cannot convert 'boost::detail::error_property_not_found' to 'long int' in initialization

Can anyone see what I am doing wrong?

#include <iostream>                  // for std::cout
#include <utility>                   // for std::pair
#include <algorithm>                 // for std::for_each
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/kolmogorov_max_flow.hpp>

using namespace boost;

// create a typedef for the Graph type
typedef adjacency_list<vecS, vecS, bidirectionalS> Graph;

int main(int,char*[])
{
   // declare a graph object
    Graph g(2); //a graph with 2 vertices

    // add the edges to the graph object
    for (int i = 0; i < 1; ++i)
    {
        add_edge(0, 1, g); //add an edge between node 0 and node 1
    }
   
    //find min cut
    //typedef adjacency_list_traits<vecS, vecS, directedS> Traits; //if we want a directed graph
    typedef adjacency_list_traits<vecS, vecS, bidirectionalS> Traits;

    Traits::vertex_descriptor s, t;

//the error is on this line
    long flow = kolmogorov_max_flow(g, s, t); // a list of sources will be returned in s, and a list of sinks will be returned in t
    std::cout << "Max flow is: " << flow << std::endl;
   
    return 0;
}


Also, I see that you can add edge weights like this:
const int num_nodes = 5;
E edges[] = { E(0,2),
E(1,1), E(1,3), E(1,4),
E(2,1), E(2,3),
E(3,4),
E(4,0), E(4,1) };
int weights[] = { 1, 2, 1, 2, 7, 3, 1, 1, 1};

Graph G(edges + sizeof(edges) / sizeof(E), weights, num_nodes);


but if I want to add edges like this:
for (int i = 0; i < 1; ++i)
{
add_edge(0, 1, g); //add an edge between node 0 and node 1
}

How would I specify the edge weights?


Thanks!

David