Boost logo

Boost Users :

Subject: Re: [Boost-users] graph cut compilation error
From: David Doria (daviddoria+boost_at_[hidden])
Date: 2009-09-09 08:22:11


On Tue, Sep 8, 2009 at 2:42 PM, David Doria
<daviddoria+boost_at_[hidden]<daviddoria%2Bboost_at_[hidden]>
> wrote:

> On Tue, Sep 8, 2009 at 1:17 PM, Jeremiah Willcock <jewillco_at_[hidden]>wrote:
>
>> On Tue, 8 Sep 2009, David Doria wrote:
>>
>> 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
>>>
>>
>> You are missing the edge weights and other property maps described in the
>> documentation for kolmogorov_max_flow; you can supply them either as
>> parameters to the kolmogorov_max_flow function or as particular property
>> maps in your graph. You can add properties as template parameters to the
>> adjacency_list class (see the documentation for how to do that), or use
>> external properties. Once you have properties, you can use add_edge(source,
>> target, prop, g) to add edges with properties.
>>
>> -- Jeremiah Willcock
>> __
>
>
> Jeremiah,
>
> Thanks for the response. I am very new to boost, so I am not quite getting
> the Property Map idea.
> It seems like you can just provide a whole list of template arguments that
> are of type property<> to the adjacency_list object. It the kolmogorov
> example (
> http://www.boost.org/doc/libs/1_39_0/libs/graph/doc/kolmogorov_max_flow.html)
> , it looks like the only property that is needed is edge_capacity, so I
> defined EdgeCapacityProperty (it was actually quite a complicated property,
> depending on edge_reverse as well as edge_residual_capacity). However, I am
> still getting "conversion from error_property_not_found to
> EdgeCapacityProperty requested" when I try to call the maxflow function. Is
> this getting closer?
>
> I guess I am following the property<> stuff, but not the property_map<>
> idea? Here is the latest attempt:
>
> #include <iostream> // for std::cout
> #include <boost/graph/adjacency_list.hpp>
> #include <boost/graph/kolmogorov_max_flow.hpp>
>
> using namespace boost;
>
> typedef adjacency_list_traits<vecS, vecS, bidirectionalS> Traits;
>
> typedef property<edge_reverse_t, Traits::edge_descriptor>
> EdgeReverseProperty;
> typedef property<edge_residual_capacity_t, long, EdgeReverseProperty>
> EdgeResidualCapacityProperty;
> typedef property<edge_capacity_t, double, EdgeResidualCapacityProperty>
> EdgeCapacityProperty;
>
> typedef adjacency_list<vecS, vecS, bidirectionalS, EdgeCapacityProperty>
> Graph; //simple
>
> int main(int,char*[])
> {
> // declare a graph object
> Graph g(2); //a graph with 2 vertices
>
> //add an edge between node 0 and node 1 with weight (capacity) 2.3
> EdgeCapacityProperty e = 2.3;
> add_edge(0, 1, e, g);
>
> //find min cut
>
> Traits::vertex_descriptor s, t;
> //double 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
> EdgeCapacityProperty 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;
> }
>
>
> Thanks,
>
> David
>

Any clues as to what I've done wrong? Maybe a simple example like this could
be put on the kolmogorov documentation page?

Thanks,

David



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net