Boost logo

Boost Users :

Subject: [Boost-users] Assigning vertex properties
From: David Doria (daviddoria_at_[hidden])
Date: 2011-06-06 19:42:18


I am trying to assign names to vertices.

I made a typedef boost::property<boost::vertex_name_t, std::string>
VertexProperty; and tried to set a label for vertex 0 in two ways:

A)
  g[0] = "Vertex0";

and B)

  boost::property_map<Graph, boost::vertex_name_t>::type value =
boost::get(boost::vertex_name_t(), g);
  boost::put(value, 0, "Vertex0");

Neither compiles. In the second one, the problem with this:
boost::put(value, 0, "Vertex0"); is that "0" is not the right type -
I guess the vertex IDs should be vertex_descriptor's instead of ints?
How do I get the descriptor of vertex #0 ?

Here is the full code:

http://codepad.org/7VYELJan

Thanks,

David


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