|
Boost Users : |
Subject: Re: [Boost-users] [BGL] add_edge also adds a vertex
From: Andrew Sutton (andrew.n.sutton_at_[hidden])
Date: 2010-02-07 09:25:16
>
> > std::pair< graph_traits<Graph>::edge_descriptor, bool > p = add_edge
> > (*vertices(g).first, *vertices(g).second, g);
>
> The function vertices returns an iterator range. In my understanding an
> iterator range is a pair of iterators [first, second) so that second
> can be reached from first with increment operations, _but_ is not part
> of the iterator range itself. It could be an iterator like one returned
> by the end-function of a stl-vector. It shall not be dereferenced!
>
>
I'll also add that adjacency_list with vecS as a vertex set will add
vertices in add_edge if an invalid vertex descriptor is given -- of which
vertices(g).second is an invalid itetator. It's equivalent to
end(vertices(g)) if you're using Boost.Range.
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