| 1 | #include <boost/graph/directed_graph.hpp>
|
|---|
| 2 | #include <boost/graph/graphviz.hpp>
|
|---|
| 3 | #include <boost/property_map/dynamic_property_map.hpp>
|
|---|
| 4 | #include <iostream>
|
|---|
| 5 | #include <string>
|
|---|
| 6 |
|
|---|
| 7 | typedef boost::directed_graph<
|
|---|
| 8 | boost::property<boost::vertex_rank_t, int,
|
|---|
| 9 | boost::property<boost::vertex_name_t, std::string> >,
|
|---|
| 10 | boost::property<boost::edge_weight_t, int>,
|
|---|
| 11 | boost::no_property> Graph;
|
|---|
| 12 |
|
|---|
| 13 | int main()
|
|---|
| 14 | {
|
|---|
| 15 | Graph g;
|
|---|
| 16 | boost::dynamic_properties dp;
|
|---|
| 17 | dp.property("node_id", get(boost::vertex_name, g));
|
|---|
| 18 | dp.property("label", get(boost::edge_weight, g));
|
|---|
| 19 | dp.property("len", get(boost::edge_weight, g));
|
|---|
| 20 | write_graphviz_dp(std::cout, g, dp);
|
|---|
| 21 | return 0;
|
|---|
| 22 | }
|
|---|