Boost logo

Boost Users :

Subject: Re: [Boost-users] graph cut compilation error
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2009-09-09 12:29:27


> Jeremiah,
>
> Rather than spam, I'd call it fantastic information! I really appreciate your time.
>
> Although it compiles, the code you sent seems to segfault on the kolmogorov call. Maybe because we didn't specify a source and
> sink? Shouldn't it work without specifying them, thought? There should be two different mincut problems that can be solved - 1)
> the min cut on the entire graph and 2) the min cut dividing a specified source and sink (or multiple sources and/or sinks). Do you
> know how to do that/why it is segfaulting?

I believe it wants specific source and target vertices. The other
properties are not initialized either.

> Some other questions:
>
> 1) So this line creates two vertices:
> Graph g(2);
>
> then since the V0->V1 edge already exists, the add_edge function doesn't add another edge, it simply returns something like a
> pointer to the already existing edge so that properties, can be assigned to it, correct?

That line creates two vertices, but does not create any edges. The
add_edge function will return a pointer to the existing edge (I believe)
when the edge already exists and the graph does not support parallel
edges.

> 2) Since add_edge(..).first is the actual edge, it is implied that this a pair and hence a .second - what is stored in the
> .second?

Whether a new edge was added; see
http://www.boost.org/doc/libs/1_40_0/libs/graph/doc/MutableGraph.html for
details.

> 3) Would I get the edge weight like this:?
> double ew = get(edge_capacity, g, add_edge(0, 1, g).first);

You would want to get the result of add_edge.first into a variable and use
that. Otherwise, yes, your syntax is correct. You can look at
http://www.boost.org/doc/libs/1_40_0/libs/graph/doc/PropertyGraph.html for
the get and put calls.

-- Jeremiah Willcock


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