My expectation was that the iterator would only show me the vertices for which I added edges, but instead it shows vertices from 0..7, essentially from the low value to the high value. This seems to be a feature, but I don't know where to look to find an explanation.
It certainly is a feature. There are many cases when you want to know
about ALL of the vertices, not just the ones with edges connected to
them.
It sounds like you are actually interested in an edge iterator instead
of a vertex iterator. Here's some example code that demonstrates an
edge iterator. Just paste this into your code before the return
statement. It loops through every edge in your graph, and outputs the
source and destination vertices in this form: "X <--> Y". (where X and
Y are vertex numbers)
[code]
typedef boost::graph_traits<Graph>::edge_iterator edge_iter;
std::pair