|
Boost Users : |
From: Aaron Windsor (aaron.windsor_at_[hidden])
Date: 2007-03-05 20:03:05
On 3/5/07, Shufei Fan <fansf_at_[hidden]> wrote:
> Hi,
> In my application, the order in which edges are retreaved is also important to
> me. So my question is, when I iterate through an vertex's out_edges, do they
> show up in the order in which the edges are inserted, or any other principals
> are used in order of iteration? Example:
> ......
> typename graph_traits<Graph>::out_edge_iterator out_i, out_end;
> typename graph_traits<Graph>::edge_descriptor e;
> for (tie(out_i, out_end) = out_edges(v, g);
> out_i != out_end; ++out_i)
> {
> e = *out_i;
> Vertex src = source(e, g), targ = target(e, g);
> std::cout << "(" << get(vertex_id, src)
> << "," << get(vertex_id, targ) << ") ";
> }
> ......
> How are these edges ordered in the output? And is it right all those iterators
> iterates in the same principals/order?
Hi Shufei,
The order in which edges/vertices appear when you iterate over them
is undefined - in both the BGL graph concepts
(http://www.boost.org/libs/graph/doc/graph_concepts.html)
and in the graph implementations provided with the BGL (adjacency_list,
adjacency_matrix, etc.)
Regards,
Aaron
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