Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2004-06-30 11:55:48

Hi Daniel,

There is no set_property function defined in public interface of
adjacency_list or subgraph. (there is an undocumented set_property
function for adjacency_list. I forget why that function is there.)

In any event, the documented get_property function returns a reference,
so you can use it to get and set. I know this is confusing... sorry!

Here's a working example:

#include <string>
#include <iostream>
#include <boost/cstdlib.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/subgraph.hpp>

   using namespace boost;
   using std::string;

   typedef adjacency_list<vecS, vecS, directedS,no_property,
     property<edge_index_t, int>,
     property<graph_name_t, string> > graph_t;

   graph_t g;
   get_property(g, graph_name) = "graph";

   std::cout << "name: " << get_property(g, graph_name) << std::endl;

   typedef subgraph<graph_t> subgraph_t;

   subgraph_t sg;
   get_property(sg, graph_name) = "subgraph";

   std::cout << "name: " << get_property(sg, graph_name) << std::endl;

   return exit_success;


Jeremy Siek <jsiek_at_[hidden]>
Ph.D. Student, Indiana University Bloomington
C++ Booster (

Boost list run by bdawes at, gregod at, cpdaniel at, john at