|
Boost Users : |
Subject: [Boost-users] [BGL] Correct idiom for working with vertices.
From: Matthew Markland (mwmarkland_lists_at_[hidden])
Date: 2015-11-04 10:43:02
All:
I'm building a graph on which I will be running betweenness centrality. This graph consists of a number of edges represented as pairs. For example
1 20
15 10
would represent an edge from 1<->20 and one from 15<->10. These are bidirectional.
My initial code created a property_map for the centrality results and then walked through that map using num_vertices(g) as the limit for the for-loop. What I've realized now, though, is that when BGL generates the values for num_vertices (and the iterators for vertices also), it "fills in" the gaps. So, in the graph above there would be 20 vertices that would be interated through even though most of those have no relation to edges in the graph.
So, I'm wondering what the usual idiom is in this situation. Should I instead iterator over edges and pull information from the source and target vertices of the edges?
Thanks in advance for the information!
Matt
---- Matthew Markland mwmarkland_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