1 //=======================================================================
2 // Copyright 2001 Indiana University.
3 // Author: Jeremy G. Siek
4 //
5 // Distributed under the Boost Software License, Version 1.0. (See
6 // accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8 //=======================================================================
9
10 #include <boost/config.hpp>
11 #include <boost/graph/adjacency_list.hpp>
12 #include <iostream>
13
main()14 int main()
15 {
16 using namespace boost;
17 typedef adjacency_list< vecS, vecS, bidirectionalS, no_property,
18 property< int, edge_weight_t >, no_property, vecS >
19 Graph;
20
21 const std::size_t n = 3;
22 typedef std::pair< std::size_t, std::size_t > E;
23 E edge_array[] = { E(0, 1), E(0, 2), E(0, 1) };
24 const std::size_t m = sizeof(edge_array) / sizeof(E);
25 Graph g(edge_array, edge_array + m, n);
26
27 graph_traits< Graph >::edge_iterator edge_iterator;
28 for (std::size_t i = 0; i < m; ++i)
29 {
30 const graph_traits< Graph >::edge_iterator e = edges(g).first + i;
31 std::cout << *e << " ";
32 }
33 std::cout << std::endl;
34
35 return 0;
36 }
37