|
Boost Users : |
Subject: Re: [Boost-users] Boost Graph Library mysterious compile errors
From: Andrew Sutton (andrew.n.sutton_at_[hidden])
Date: 2009-04-28 07:55:12
>
> Judging by the documentation I was under the impression that this was a
> default property that all edges would have. Is this not the case? How would
> I add it?
I already tried putting a "double edge_weight" field in my EdgeProperties
> struct, didn't help.
>
There are no default edge properties - no default vertex properties either
(with a few exceptions).
If you are using bundled properties, then you have to wrap the access to
your edge weights with a property map and pass that map to various
algorithms. For example:
typedef property_map<Graph, dobule EdgeProps::*>::type WeightMap;
WeightMap wm = get(&EdgeProp::weight, g);
Edge e = // get some edge descriptor from g
assert(g[e].weight == wm(e));
Passing wm to algorithms will allow them to use your custom edge weights.
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