// system headers #include #include #include // program options // #include // Boost graph library, including LEDA wrapper // #include //#include "./leda_graph.hpp" #include #include #include #include #include //#include "breadth_first_search.hpp" // graph_tool: graphml reader #include "graphml.hpp" #include "bfs_distmap_as_color_map.hpp" struct EdgeProperties; struct VertexProperties { double x; double y; double weight; int dist; boost::graph_traits< boost::adjacency_list >::edge_descriptor pred; int app_height; bool mark; }; struct EdgeProperties { double length; }; int main() { using namespace boost; using namespace std; typedef adjacency_list Graph; Graph G; //(5); /*boost::add_edge(0, 2, G); boost::add_edge(1, 1, G); boost::add_edge(1, 3, G); boost::add_edge(1, 4, G); boost::add_edge(2, 1, G); boost::add_edge(2, 3, G); boost::add_edge(2, 4, G); boost::add_edge(3, 1, G); boost::add_edge(3, 4, G); boost::add_edge(4, 0, G); boost::add_edge(4, 1, G); */ dynamic_properties dp; dp.property("coord1", get(&VertexProperties::x, G)); dp.property("coord2", get(&VertexProperties::y, G)); dp.property("length", get(&EdgeProperties::length, G)); std::ifstream in; in.open("planar100k.graphml", ios::in); read_graphml(in, G, dp); graph_traits::vertex_descriptor s = *((vertices(G)).first); typedef graph_traits::vertex_iterator v_iter; v_iter vi, vi_end; for (tie(vi, vi_end)=vertices(G); vi!=vi_end; vi++) G[*vi].dist = -1; std::cout << "#vertices: " << num_vertices(G) << std::endl; breadth_first_visit(G, s, visitor(boost::make_bfs_visitor (record_distances(get(&VertexProperties::dist, G), on_tree_edge()))) .color_map(make_map_as_colormap(get(&VertexProperties::dist, G), -1)) ); std::cout << "done" << std::endl; }