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