[BGL] Simple question about accessing vertex property

Hi, How do I access the vertex_index property of a vertex? Is it necessary to use the get function? More precisaly, let us consider the following: typedef adjacency_list<vecS, vecS, bidirectionalS, no_property, property<edge_weight_t, int> > TGraph; typedef graph_traits<TGraph>::vertex_descriptor TNode; Suppose that 'vertex' is a TNode. Is it correct to do int idx = vertex; to get in idx the vertex_index of vertex? Thanks in adavnce, Giulio

hi, i've implemented an extended form of 'fill' algorithm that can handle multi-dimensional containers and would appreciate comments on whether: a) i've reinvented the wheel and such code is already available in boost, b) i've made some obvious mistake that my (admittedly minimal) testing hasn't found yet, c) it would be useful to anybody :) the code is given below (namespace declarations removed): template<class Range, class Value> typename enable_if_c<is_convertible<Value, Range>::value>::type fill(Range& range, Value const& value) { range = value; } template<class Range, class Value> typename disable_if_c<is_convertible<Value, Range>::value>::type fill(Range& range, Value const& value) { for(range_iterator<Range>::type i = boost::begin(range); i != boost::end(range); ++i) fill(*i, value); } comments appreciated, thanks, ian whittley

On Oct 9, 2005, at 9:56 AM, Giulio Veronesi wrote:
How do I access the vertex_index property of a vertex? Is it necessary to use the get function? More precisaly, let us consider the following:
typedef adjacency_list<vecS, vecS, bidirectionalS, no_property, property<edge_weight_t, int> > TGraph;
typedef graph_traits<TGraph>::vertex_descriptor TNode;
Suppose that 'vertex' is a TNode. Is it correct to do
int idx = vertex;
to get in idx the vertex_index of vertex?
It is correct for adjacency_list when vertex_listS = vecS. In the more general case, one would write: graph_traits<TGraph>::vertices_size_type idx = get(vertex_index, graph, vertex); Doug
participants (3)
-
Doug Gregor
-
Giulio Veronesi
-
Ian Whittley