|
Boost Users : |
Subject: Re: [Boost-users] Graph Library Random Access Iterators?
From: Theodore McCormack (guzbit_at_[hidden])
Date: 2010-03-06 13:56:59
I need to use mutability in my graph. How would you use the vecS in the
EdgeList for adjacency_list in a random access fashion?
On Sat, Mar 6, 2010 at 1:21 PM, Theodore McCormack <guzbit_at_[hidden]> wrote:
> Hello all,
> I am trying to iterate through a list of edges in the boost graph library,
> but i would like to advance more than one at a time or be able to use random
> access to an edge in the set. For example:
>
> Currently, to find the edge at index in the edge set I have to iterate
> through all the edges:
>
> Edge e;
> int count = 0;
> for (edge_range_t er = edges(graph); er.first != er.second; er.first++)
> {
> e = (*er.first);
> if (count == index)
> break;
> count++;
> }
> return e;
>
> I would like something like:
>
> Edge e;
> edge_range_t er = edges(graph);
> e = (*er[index].first);
> return e;
>
> Is there a way to index with iterators?
>
> Regards
>
>
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