Boost logo

Boost Users :

Subject: Re: [Boost-users] [BGL] Is it possible to control algorithm's behavior by visitor?
From: Andrew Sutton (andrew.n.sutton_at_[hidden])
Date: 2009-05-21 09:50:22


> For example, a graph's edge have 2 property: weight & capacity. I need to
> compute a path which have min weight and any edges in this path has bigger
> capacity than 'x'.
>
> Seems BGL can't do this uniformly because shortest_path function has no
> place to accept others parameter(constraints). Some functors such as
> distance_compare seems only work on weight.

That's not entirely true. distance_compare compares the results of lookups
on the distance_map provided to the function. A property map is actually
very much like a functor except that it supports reads and writes. This
means you can build a custom property map that returns (for example) a pair
containing the weight and capacity for each edge. The distance_compare
function would then compare the resulting pairs.

I mean BGL cope with pure graph theory problem nicely, but when the
> application gets complex(still can be reduced to pure graph data structure,
> but more rules restricted on algorithm), BGL fails.

Am I right?

Not really.

Andrew Sutton
andrew.n.sutton_at_[hidden]



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