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 template <typename Graph, typename VertexIndexMap> 22 typename graph_traits<Graph>::vertices_size_type profile(const Graph & g,VertexIndexMap index)23 profile(const Graph& g, VertexIndexMap index) 24 { 25 typename graph_traits<Graph>::vertices_size_type b = 0; 26 typename graph_traits<Graph>::vertex_iterator i, end; 27 for (boost::tie(i, end) = vertices(g); i != end; ++i){ 28 b += ith_bandwidth(*i, g, index) + 1; 29 } 30 31 return b; 32 } 33 34 template <typename Graph> 35 typename graph_traits<Graph>::vertices_size_type profile(const Graph & g)36 profile(const Graph& g) 37 { 38 return profile(g, get(vertex_index, g)); 39 } 40 41 42 } // namespace boost 43 44 #endif // BOOST_GRAPH_PROFILE_HPP 45