|
Boost Users : |
Subject: [Boost-users] How to use graph properties
From: Paolo Bolzoni (paolo.bolzoni.brown_at_[hidden])
Date: 2014-02-10 12:02:15
Dear list,
I need to keep track of two special vertices in my graph, So
I thought to attach two vertex_descriptor as graph
properties so have easy access any moment. Properties work
fine for edges or vertices, but I cannot make them work for
the graph.
In the bottom is the C++ code. The graph has the two properties,
now how I cat get and put them? This code does not work and
the error messages are impossible to read for me.
Otherwise that is the way to keep graph-wise properties?
The code compiles removing the two puts, so I assume the
error is there.
Yours sincerely,
Paolo
#include <boost/graph/adjacency_list.hpp>
namespace boost {
enum graph_source_t { graph_source = 100 };
BOOST_INSTALL_PROPERTY (graph, source);
enum graph_destination_t { graph_destination = 101 };
BOOST_INSTALL_PROPERTY (graph, destination);
}
typedef size_t graph_vertex;
typedef boost::adjacency_list <
boost::vecS,
boost::vecS,
boost::undirectedS,
boost::no_property,
boost::no_property,
boost::property < boost::graph_source_t, graph_vertex,
boost::property < boost::graph_destination_t, graph_vertex,
boost::no_property>>>
graph_t;
static_assert(std::is_same<graph_vertex,
boost::graph_traits<graph_t>::vertex_descriptor>::value, "Check out
the vertex descriptor type!");
int main() {
using namespace boost;
graph_t g;
add_edge(0, 1, g);
put(graph_destination, g, 0);
put(graph_source, g, 1);
}
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