Boost logo

Boost Users :

Subject: [Boost-users] Retrieving edge weights
From: David Doria (daviddoria_at_[hidden])
Date: 2011-06-11 17:10:38

I found one way to get edge weights:

  typedef boost::property_map<Graph, boost::edge_weight_t>::type EdgeWeightMap;
  EdgeWeightMap edgeWeightMap = get(boost::edge_weight, g);

  std::pair<Graph::edge_descriptor, bool> edgePair = boost::edge(v0, v1, g);
  Graph::edge_descriptor edge = edgePair.first;

That seems like a lot of work though. It looks like there is a
operator[](edge_descriptor), but I don't understand how to use it:

I tried:


but there are compiler errors.

The whole demonstration is here:

Any suggestions? Or is the first way the only/best way?



Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at