|
Boost : |
Subject: [boost] [graph] bug in ith_bandwidth?
From: Joel Young (jdy_at_[hidden])
Date: 2011-06-30 16:37:04
Is ith_bandwidth broken? It only measures the distance between indices when the
source is greater than the sink. Should it look like this:
template <typename Graph, typename VertexIndexMap>
typename graph_traits<Graph>::vertices_size_type
ith_bandwidth(typename graph_traits<Graph>::vertex_descriptor i,
const Graph& g,
VertexIndexMap index)
{
BOOST_USING_STD_MAX();
typedef typename graph_traits<Graph>::vertices_size_type size_type;
size_type b = 0;
typename graph_traits<Graph>::out_edge_iterator e, end;
for (boost::tie(e, end) = out_edges(i, g); e != end; ++e) {
int f_i = get(index, i);
int f_j = get(index, target(*e, g));
using namespace std; // to call abs() unqualified
if(f_i > f_j)
b = max BOOST_PREVENT_MACRO_SUBSTITUTION (b, size_type(f_i - f_j));
else
b = max BOOST_PREVENT_MACRO_SUBSTITUTION (b, size_type(f_j - f_i));
}
return b;
}
Joel
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk