boost_graph-vc80-mt-gd-1_38.lib
#include <fstream>
#include <boost/graph/graphviz.hpp>
//#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/lexical_cast.hpp>
#include <iostream>
namespace boost {
enum edge_haha_t{edge_haha = 9871};
BOOST_INSTALL_PROPERTY(edge, haha) ;
}
int main(int argc, char** argv) {
using namespace boost ;
// Graph properties
typedef property < graph_name_t, std::string
//property<graph_edge_attribute_t, std::string>
> graph_p;
// Graph properties
//typedef property < graph_name_t, std::string,
// property<graph_edge_attribute_t, std::string>
//> graph_p;
typedef property< vertex_name_t, std::string> r_vertex_p ;
typedef property<edge_weight_t, int, property<edge_weight2_t, std::string,
property<edge_haha_t, std::string> >
> r_edge_p ;
typedef adjacency_list<vecS, vecS, directedS,
r_vertex_p, r_edge_p, graph_p> r_graph_t ;
// Construct an empty graph and prepare the dynamic_property_maps.
r_graph_t r_graph ;
dynamic_properties dp;
property_map<r_graph_t, vertex_name_t>::type name =
get(vertex_name, r_graph);
dp.property("node_id",name);
property_map<r_graph_t, edge_weight_t>::type weight =
get(edge_weight, r_graph);
dp.property("label",weight);
property_map<r_graph_t, edge_weight2_t>::type weight2 =
get(edge_weight2, r_graph) ;
dp.property("style", weight2) ;
property_map<r_graph_t, edge_haha_t>::type haha =
get(edge_haha, r_graph) ;
dp.property("haha",haha) ;
//boost::ref_property_map<r_graph_t*, std::string> style(
// get_property(r_graph,graph_graph_attribute)) ;
//dp.property("style", style) ;
//graph_property<r_graph_t, graph_edge_attribute_t>::type e_a =
//get_property(r_graph, edge_weight2) ;
// get(edge_weight2, r_graph) ;
//dp.property("style",e_a);
// property_map<r_graph_t, graph_edge_attribute_t>::type edge_style =
// get(graph_edge_attribute, r_graph) ;
// dp.property("style", edge_style) ;
// Use ref_property_map to turn a graph property into a property map
boost::ref_property_map<r_graph_t*,std::string>
gname(get_property(r_graph,graph_name));
dp.property("name",gname);
dp.property("size",gname) ;
dp.property("ratio",gname) ;
// boost::ref_property_map<r_graph_t*, std::string>
// estyle(get_property(r_graph, graph_edge_attribute)) ;
//dp.property("style", estyle) ;
// Sample graph as an std::istream;
std::string node_id = "node_id" ;
std::ifstream file_in("ospf-graph.dot") ;
bool status = read_graphviz(file_in,r_graph,dp);
graph_traits<r_graph_t>::vertex_iterator it, it_end ;
for(tie(it,it_end) = vertices(r_graph) ; it != it_end ; ++it) {
std::cout << name[*it] << " " ;
//std::cout << mass[*it] << " " ;
}
std::cout << std::endl ;
graph_traits<r_graph_t>::edge_iterator ei, ei_end ;
for(tie(ei,ei_end) = edges(r_graph); ei != ei_end ; ++ei) {
std::cout << weight[*ei] << " "
<< weight2[*ei] << " " << haha[*ei]<< std::endl;
}
std::cout << status << std::endl ;
return 0 ;
}