1 //
2 //=======================================================================
3 // Copyright 2002 Marc Wintermantel (wintermantel@even-ag.ch)
4 // ETH Zurich, Center of Structure Technologies
5 // (https://web.archive.org/web/20050307090307/http://www.structures.ethz.ch/)
6 //
7 // Distributed under the Boost Software License, Version 1.0. (See
8 // accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
10 //=======================================================================
11
12 #ifndef BOOST_GRAPH_PROFILE_HPP
13 #define BOOST_GRAPH_PROFILE_HPP
14
15 #include <boost/graph/graph_traits.hpp>
16 #include <boost/detail/numeric_traits.hpp>
17 #include <boost/graph/bandwidth.hpp>
18
19 namespace boost
20 {
21
22 template < typename Graph, typename VertexIndexMap >
profile(const Graph & g,VertexIndexMap index)23 typename graph_traits< Graph >::vertices_size_type profile(
24 const Graph& g, VertexIndexMap index)
25 {
26 typename graph_traits< Graph >::vertices_size_type b = 0;
27 typename graph_traits< Graph >::vertex_iterator i, end;
28 for (boost::tie(i, end) = vertices(g); i != end; ++i)
29 {
30 b += ith_bandwidth(*i, g, index) + 1;
31 }
32
33 return b;
34 }
35
36 template < typename Graph >
profile(const Graph & g)37 typename graph_traits< Graph >::vertices_size_type profile(const Graph& g)
38 {
39 return profile(g, get(vertex_index, g));
40 }
41
42 } // namespace boost
43
44 #endif // BOOST_GRAPH_PROFILE_HPP
45