9
3

profile.hpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. #ifndef BOOST_GRAPH_PROFILE_HPP
  12. #define BOOST_GRAPH_PROFILE_HPP
  13. #include <boost/graph/graph_traits.hpp>
  14. #include <boost/detail/numeric_traits.hpp>
  15. #include <boost/graph/bandwidth.hpp>
  16. namespace boost {
  17. template <typename Graph, typename VertexIndexMap>
  18. typename graph_traits<Graph>::vertices_size_type
  19. profile(const Graph& g, VertexIndexMap index)
  20. {
  21. typename graph_traits<Graph>::vertices_size_type b = 0;
  22. typename graph_traits<Graph>::vertex_iterator i, end;
  23. for (boost::tie(i, end) = vertices(g); i != end; ++i){
  24. b += ith_bandwidth(*i, g, index) + 1;
  25. }
  26. return b;
  27. }
  28. template <typename Graph>
  29. typename graph_traits<Graph>::vertices_size_type
  30. profile(const Graph& g)
  31. {
  32. return profile(g, get(vertex_index, g));
  33. }
  34. } // namespace boost
  35. #endif // BOOST_GRAPH_PROFILE_HPP