Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Graph] Accessing edge properties via an edge_iterator
From: David Abrahams (dave_at_[hidden])
Date: 2008-12-18 13:23:50


on Mon Dec 08 2008, Julius Ziegler <ziegler-AT-mrt.uka.de> wrote:

> Hello list,
>
> I wonder what is the fastest method to access edge properties of an adjacency_list
> when iterating over edges. Actually, the only way I know of for accessing properties
> is via operator[]:
>
> typedef boost::adjacency_list<listS, vecS, boost::directedS, NodeProperty,
> EdgeProperty > Graph;
>
> Graph g;
>
> for( tie( ei, ei_end ) = edges( graph ); ei != ei_end; ++ei )
> {
> g[*ei]=something;
> }

IIUC that allows you to access bundled edge properties, but in the
general case (where you are not depending on the properties being stored
in bundles or even internally to the graph) you'd extract property maps
and use get and put to do it. Either way should be equally fast.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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