1 //======================================================================= 2 // Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, 3 // 4 // Distributed under the Boost Software License, Version 1.0. (See 5 // accompanying file LICENSE_1_0.txt or copy at 6 // http://www.boost.org/LICENSE_1_0.txt) 7 //======================================================================= 8 #include <boost/graph/leda_graph.hpp> 9 #include <iostream> 10 #undef string // LEDA macro! main()11int main() 12 { 13 using namespace boost; 14 typedef leda::GRAPH< std::string, int > graph_t; 15 graph_t g; 16 g.new_node("Philoctetes"); 17 g.new_node("Heracles"); 18 g.new_node("Alcmena"); 19 g.new_node("Eurystheus"); 20 g.new_node("Amphitryon"); 21 typedef property_map< graph_t, vertex_all_t >::type NodeMap; 22 NodeMap node_name_map = get(vertex_all, g); 23 graph_traits< graph_t >::vertex_iterator vi, vi_end; 24 for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) 25 std::cout << node_name_map[*vi] << std::endl; 26 return EXIT_SUCCESS; 27 } 28