// 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; /* ynamic_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 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); 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; 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; }