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