Commit 2d5dca6c authored by Tiago Peixoto's avatar Tiago Peixoto

Trivial fix for several compilation warnings

parent c1c2aa9c
......@@ -206,7 +206,7 @@ struct get_absolute_trust
typename graph_traits<Graph>::vertex_descriptor v = vertex(i, g);
if (v == graph_traits<Graph>::null_vertex())
continue;
for (size_t j = 0; j < N; ++j)
for (size_t j = 0; j < size_t(N); ++j)
if (t_count[v][j] > 0)
t[v][j] /= t_count[v][j];
}
......
......@@ -84,7 +84,7 @@ void get_motifs(GraphInterface& g, size_t k, python::list subgraph_list,
list = vector<u_graph_t>();
try
{
for (size_t i = 0; i < python::len(subgraph_list); ++i)
for (int i = 0; i < python::len(subgraph_list); ++i)
{
GraphInterface& sub =
python::extract<GraphInterface&>(subgraph_list[i]);
......@@ -101,7 +101,7 @@ void get_motifs(GraphInterface& g, size_t k, python::list subgraph_list,
vector<size_t> phist;
vector<double> plist;
double total = 1;
for (size_t i = 0; i < python::len(p); ++i)
for (int i = 0; i < python::len(p); ++i)
{
plist.push_back(python::extract<double>(p[i]));
total *= plist[i];
......@@ -123,7 +123,7 @@ void get_motifs(GraphInterface& g, size_t k, python::list subgraph_list,
if (fill_list)
{
for (size_t i = 0; i < python::len(subgraph_list); ++i)
for (int i = 0; i < python::len(subgraph_list); ++i)
subgraph_list.pop();
bool done = false;
......
......@@ -37,7 +37,7 @@ typename mpl::if_<
double, int>::type
min(const T1& v1, const T2& v2)
{
if (v1 <= v2)
if (v1 <= T1(v2))
return v1;
else
return v2;
......
......@@ -37,7 +37,7 @@ typename mpl::if_<
double, int>::type
min(const T1& v1, const T2& v2)
{
if (v1 <= v2)
if (v1 <= T1(v2))
return v1;
else
return v2;
......
......@@ -218,10 +218,10 @@ public:
if (_biased && !_candidates_set.empty() &&
_erased_prob >= _probs.back()/3)
{
for (int i = _probs.size() - 1; i > 0; --i)
for (int i = int(_probs.size()) - 1; i > 0; --i)
_probs[i] -= _probs[i-1];
for (int i = 0; i < _candidates.size(); ++i)
for (size_t i = 0; i < _candidates.size(); ++i)
{
while (i < _erased.size() && _erased[i])
{
......@@ -699,7 +699,6 @@ struct gen_random_graph
for (int i = 0; i < int(sources.size()); ++i)
{
dvertex_t source = sources[i], target;
deg_t source_deg = gen_strat.GetDegree(source);
// in undirected graphs, there's no difference between source and
// target
......
......@@ -243,7 +243,7 @@ struct graph_rewire
}
// for each edge simultaneously rewire its source and target
for (size_t i = 0; i < int(edges.size()); ++i)
for (size_t i = 0; i < edges.size(); ++i)
{
if (!is_edge[i])
continue;
......@@ -336,7 +336,7 @@ public:
//try randomly drawn pairs of edges until one satisfies all the
//consistency checks
bool found = false;
edge_t es, et;
edge_t es = e, et = e;
typedef random_permutation_iterator
<typename vector<index_t>::iterator, rng_t> random_edge_iter;
......
......@@ -63,13 +63,13 @@ struct graph_copy
// copy constructor
GraphInterface::GraphInterface(const GraphInterface& gi)
:_mg(),
_nedges(gi._nedges),
_reversed(gi._reversed),
_directed(gi._directed),
_vertex_index(get(vertex_index,_mg)),
_edge_index(get(edge_index_t(),_mg)),
_max_edge_index(gi._max_edge_index),
_nedges(gi._nedges),
_free_indexes(gi._free_indexes),
_max_edge_index(gi._max_edge_index),
_vertex_filter_map(_vertex_index),
_vertex_filter_invert(false),
_vertex_filter_active(false),
......
......@@ -91,7 +91,7 @@ using namespace boost;
// struct my_algorithm
// {
// template <class Graph, class ValueType>
// void operator()(Graph* g, ValueType val) const
// void operator()(Graph& g, ValueType val) const
// {
// ... do something ...
// }
......@@ -99,9 +99,10 @@ using namespace boost;
//
// ...
//
// GraphInterface g;
// typedef mpl::vector<int, double, string> value_types;
// double foo = 42.0;
// run_action(*this, my_algorithm(), value_types)(boost::any(foo));
// run_action(g, my_algorithm(), value_types)(boost::any(foo));
//
// The above line will run my_algorithm::operator() with Graph being the
// appropriate graph view type and ValueType being 'double' and val = 42.0.
......
......@@ -163,7 +163,7 @@ public:
_sum->GetArray().resize(shape);
for (size_t i = 0; i < this->_counts.num_elements(); ++i)
_sum->GetArray().data()[i] += this->_counts.data()[i];
for (size_t i = 0; i < Histogram::dim::value; ++i)
for (size_t i = 0; i < size_t(Histogram::dim::value); ++i)
{
_sum->GetDataRange()[i].first =
min(this->_data_range[i].first,
......
......@@ -93,7 +93,7 @@ struct get_distance_histogram
unchecked_vector_property_map<val_type,VertexIndex>
dist_map(vertex_index, num_vertices(g));
for (size_t j = 0; j < N; ++j)
for (size_t j = 0; j < size_t(N); ++j)
{
if (vertex(i,g) != graph_traits<Graph>::null_vertex())
dist_map[vertex(j,g)] = numeric_limits<val_type>::max();
......
......@@ -86,7 +86,7 @@ struct get_sampled_distance_histogram
vector<vertex_t> sources;
sources.reserve(num_vertices(g));
int i;
for (i = 0; i < num_vertices(g); ++i)
for (i = 0; i < int(num_vertices(g)); ++i)
if (vertex(i,g) != graph_traits<Graph>::null_vertex())
sources.push_back(vertex(i,g));
n_samples = min(n_samples, sources.size());
......
......@@ -39,7 +39,7 @@ typedef property_map_types::apply<mpl::vector<int32_t>,
mpl::bool_<false> >::type
pred_properties;
bool denominator_tree(GraphInterface& gi, size_t entry, boost::any pred_map)
void denominator_tree(GraphInterface& gi, size_t entry, boost::any pred_map)
{
run_action<graph_tool::detail::always_directed>()
(gi, bind<void>(get_denominator_tree(), _1, entry, _2),
......
......@@ -111,7 +111,7 @@ typedef property_map_types::apply<mpl::vector<uint8_t>,
mpl::bool_<false> >::type
tree_properties;
bool get_kruskal_spanning_tree(GraphInterface& gi, boost::any weight_map,
void get_kruskal_spanning_tree(GraphInterface& gi, boost::any weight_map,
boost::any tree_map)
{
......@@ -129,7 +129,7 @@ bool get_kruskal_spanning_tree(GraphInterface& gi, boost::any weight_map,
weight_maps(), edge_scalar_properties())(weight_map, tree_map);
}
bool get_prim_spanning_tree(GraphInterface& gi, size_t root,
void get_prim_spanning_tree(GraphInterface& gi, size_t root,
boost::any weight_map, boost::any tree_map)
{
typedef ConstantPropertyMap<size_t,GraphInterface::edge_t> cweight_t;
......
......@@ -25,15 +25,15 @@ using namespace graph_tool;
bool check_isomorphism(GraphInterface& gi1, GraphInterface& gi2,
boost::any iso_map);
bool get_kruskal_spanning_tree(GraphInterface& gi, boost::any weight_map,
void get_kruskal_spanning_tree(GraphInterface& gi, boost::any weight_map,
boost::any tree_map);
bool get_prim_spanning_tree(GraphInterface& gi, size_t root,
void get_prim_spanning_tree(GraphInterface& gi, size_t root,
boost::any weight_map, boost::any tree_map);
void topological_sort(GraphInterface& gi, vector<int32_t>& sort);
bool denominator_tree(GraphInterface& gi, size_t entry, boost::any pred_map);
void denominator_tree(GraphInterface& gi, size_t entry, boost::any pred_map);
void transitive_closure(GraphInterface& gi, GraphInterface& tcgi);
......
......@@ -52,7 +52,7 @@ bool operator<=(const vector<ValueType>& v1, const vector<ValueType>& v2)
// sort strings in alphabetical (ASCII) order
bool operator<=(const string s1, const string s2)
{
for (size_t i; i < s1.size(); ++i)
for (size_t i = 0; i < s1.size(); ++i)
{
if (s1[i] != s1[i])
return (s1[i] < s1[i]);
......@@ -67,7 +67,7 @@ bool operator<=(const vector<string>& v1, const vector<string>& v2)
return true;
if (v1.size() > v2.size())
return false;
for (size_t i; i < v1.size(); ++i)
for (size_t i = 0; i < v1.size(); ++i)
{
if (v1[i] > v2[i])
return false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment