source: NonGTP/Boost/boost/graph/profile.hpp @ 857

Revision 857, 2.1 KB checked in by igarcia, 19 years ago (diff)
RevLine 
[857]1//
2//=======================================================================
3// Copyright 2002 Marc Wintermantel (wintermantel@imes.mavt.ethz.ch)
4// ETH Zurich, Center of Structure Technologies (www.imes.ethz.ch/st)
5//
6// This file is part of the Boost Graph Library
7//
8// You should have received a copy of the License Agreement for the
9// Boost Graph Library along with the software; see the file LICENSE.
10// If not, contact Office of Research, University of Notre Dame, Notre
11// Dame, IN 46556.
12//
13// Permission to modify the code and to distribute modified code is
14// granted, provided the text of this NOTICE is retained, a notice that
15// the code was modified is included with the above COPYRIGHT NOTICE and
16// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE
17// file is distributed with the modified code.
18//
19// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
20// By way of example, but not limitation, Licensor MAKES NO
21// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY
22// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS
23// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS
24// OR OTHER RIGHTS.
25//=======================================================================
26//
27
28#ifndef BOOST_GRAPH_PROFILE_HPP
29#define BOOST_GRAPH_PROFILE_HPP
30
31#include <boost/graph/graph_traits.hpp>
32#include <boost/detail/numeric_traits.hpp>
33#include <boost/graph/bandwidth.hpp>
34
35namespace boost {
36
37  template <typename Graph, typename VertexIndexMap>
38  typename graph_traits<Graph>::vertices_size_type
39  profile(const Graph& g, VertexIndexMap index)
40  {
41    typename graph_traits<Graph>::vertices_size_type b = 0;
42    typename graph_traits<Graph>::vertex_iterator i, end;
43    for (tie(i, end) = vertices(g); i != end; ++i){
44      b += ith_bandwidth(*i, g, index) + 1;
45    }
46   
47    return b;
48  }
49
50  template <typename Graph>
51  typename graph_traits<Graph>::vertices_size_type
52  profile(const Graph& g)
53  {
54    return profile(g, get(vertex_index, g));
55  }
56 
57 
58} // namespace boost
59
60#endif // BOOST_GRAPH_PROFILE_HPP
Note: See TracBrowser for help on using the repository browser.