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! 11 int main()12main() 13 { 14 using namespace boost; 15 typedef leda::GRAPH < std::string, int >graph_t; 16 graph_t g; 17 g.new_node("Philoctetes"); 18 g.new_node("Heracles"); 19 g.new_node("Alcmena"); 20 g.new_node("Eurystheus"); 21 g.new_node("Amphitryon"); 22 typedef property_map < graph_t, vertex_all_t >::type NodeMap; 23 NodeMap node_name_map = get(vertex_all, g); 24 graph_traits < graph_t >::vertex_iterator vi, vi_end; 25 for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) 26 std::cout << node_name_map[*vi] << std::endl; 27 return EXIT_SUCCESS; 28 } 29