In Boost Graph Library (BGL), how can I programmatically get the type of a property such as the one associated with boost::edge_weight_t
?
I searched and found lots of examples on how to get the type of the property map, but not the type of the property itself. For example, BGL documentation below has the type of the property map for edge_weight_t
as property_map<DirectedGraph, edge_weight_t>::type
:
typedef ... DirectedGraph;
DirectedGraph digraph(V);
{
..
property_map<DirectedGraph, edge_weight_t>::type
weight = get(edge_weight, digraph);
}
But how do I get the type of the weight of the edges? (float
, int
etc.)
How do I declare variables for the edge weights with appropriate type expressions (??? below), so that I can, e.g., read into these weight values from a file/stream.
typedef ... DirectedGraph;
...
??? w;
input_s >> w;
As pointed out in comments by @llonesmiz, for a property map type
typedef property_map<Graph, boost::edge_weight_t>::type WeightMap
the type of the property (weight) value can be retrieved with property_traits
as:
typedef typename boost::property_traits<WeightMap>::value_type edge_weight_type;