Commit f3c37d4c authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Fix vertex_range to consider all types of properties

This changes the meaning of the all_selectors type, which includes all
property types, and creates a scalar_selectors type, which includes only
the scalar types.
parent de3f34f5
...@@ -32,7 +32,7 @@ assortativity_coefficient(GraphInterface& gi, ...@@ -32,7 +32,7 @@ assortativity_coefficient(GraphInterface& gi,
using namespace boost::lambda; using namespace boost::lambda;
double a, a_err; double a, a_err;
run_action<>()(gi,bind<void>(get_assortativity_coefficient(), _1, _2, run_action<>()(gi,bind<void>(get_assortativity_coefficient(), _1, _2,
var(a), var(a_err)), all_selectors()) var(a), var(a_err)), scalar_selectors())
(degree_selector(deg)); (degree_selector(deg));
return make_pair(a, a_err); return make_pair(a, a_err);
} }
...@@ -45,7 +45,7 @@ scalar_assortativity_coefficient(GraphInterface& gi, ...@@ -45,7 +45,7 @@ scalar_assortativity_coefficient(GraphInterface& gi,
double a, a_err; double a, a_err;
run_action<>()(gi, bind<void>(get_scalar_assortativity_coefficient(), run_action<>()(gi, bind<void>(get_scalar_assortativity_coefficient(),
_1, _2, var(a), var(a_err)), _1, _2, var(a), var(a_err)),
all_selectors()) scalar_selectors())
(degree_selector(deg)); (degree_selector(deg));
return make_pair(a, a_err); return make_pair(a, a_err);
} }
......
...@@ -69,7 +69,7 @@ get_vertex_avg_correlation(GraphInterface& gi, ...@@ -69,7 +69,7 @@ get_vertex_avg_correlation(GraphInterface& gi,
{ {
run_action<>()(gi, get_avg_correlation<GetNeighboursPairs> run_action<>()(gi, get_avg_correlation<GetNeighboursPairs>
(avg, dev, bins, ret_bins), (avg, dev, bins, ret_bins),
all_selectors(), all_selectors(), scalar_selectors(), scalar_selectors(),
mpl::vector<cweight_map_t>()) mpl::vector<cweight_map_t>())
(degree_selector(deg1), degree_selector(deg2), weight_prop); (degree_selector(deg1), degree_selector(deg2), weight_prop);
} }
......
...@@ -46,7 +46,7 @@ get_vertex_avg_combined_correlation(GraphInterface& gi, ...@@ -46,7 +46,7 @@ get_vertex_avg_combined_correlation(GraphInterface& gi,
run_action<>()(gi, get_avg_correlation<GetCombinedPair> run_action<>()(gi, get_avg_correlation<GetCombinedPair>
(avg, dev, bins, ret_bins), (avg, dev, bins, ret_bins),
all_selectors(), all_selectors(), scalar_selectors(), scalar_selectors(),
mpl::vector<dummy_weight>()) mpl::vector<dummy_weight>())
(degree_selector(deg1), degree_selector(deg2), dummy_weight()); (degree_selector(deg1), degree_selector(deg2), dummy_weight());
return python::make_tuple(avg, dev, ret_bins); return python::make_tuple(avg, dev, ret_bins);
......
...@@ -43,7 +43,7 @@ void graph_avg_correlations_imp1(GraphInterface& g, python::object& avg, ...@@ -43,7 +43,7 @@ void graph_avg_correlations_imp1(GraphInterface& g, python::object& avg,
wrapped_weight_t; wrapped_weight_t;
run_action<>()(g, get_avg_correlation<GetNeighboursPairs> run_action<>()(g, get_avg_correlation<GetNeighboursPairs>
(avg, dev, bins, ret_bins), (avg, dev, bins, ret_bins),
all_selectors(), all_selectors(), scalar_selectors(), scalar_selectors(),
mpl::vector<wrapped_weight_t>()) mpl::vector<wrapped_weight_t>())
(deg1, deg2, weight); (deg1, deg2, weight);
} }
......
...@@ -75,7 +75,7 @@ get_vertex_correlation_histogram(GraphInterface& gi, ...@@ -75,7 +75,7 @@ get_vertex_correlation_histogram(GraphInterface& gi,
{ {
run_action<>()(gi, get_correlation_histogram<GetNeighboursPairs> run_action<>()(gi, get_correlation_histogram<GetNeighboursPairs>
(hist, bins, ret_bins), (hist, bins, ret_bins),
all_selectors(), all_selectors(), scalar_selectors(), scalar_selectors(),
mpl::vector<cweight_map_t>()) mpl::vector<cweight_map_t>())
(degree_selector(deg1), degree_selector(deg2), weight_prop); (degree_selector(deg1), degree_selector(deg2), weight_prop);
} }
......
...@@ -50,7 +50,7 @@ get_vertex_combined_correlation_histogram(GraphInterface& gi, ...@@ -50,7 +50,7 @@ get_vertex_combined_correlation_histogram(GraphInterface& gi,
run_action<>()(gi, get_correlation_histogram<GetCombinedPair>(hist, bins, run_action<>()(gi, get_correlation_histogram<GetCombinedPair>(hist, bins,
ret_bins), ret_bins),
all_selectors(), all_selectors(), scalar_selectors(), scalar_selectors(),
mpl::vector<dummy_weight>()) mpl::vector<dummy_weight>())
(degree_selector(deg1), degree_selector(deg2), (degree_selector(deg1), degree_selector(deg2),
boost::any(dummy_weight())); boost::any(dummy_weight()));
......
...@@ -42,7 +42,7 @@ void graph_correlations_imp1(GraphInterface& g, python::object& hist, ...@@ -42,7 +42,7 @@ void graph_correlations_imp1(GraphInterface& g, python::object& hist,
wrapped_weight_t; wrapped_weight_t;
run_action<>()(g, get_correlation_histogram<GetNeighboursPairs> run_action<>()(g, get_correlation_histogram<GetNeighboursPairs>
(hist, bins, ret_bins), (hist, bins, ret_bins),
all_selectors(), all_selectors(), scalar_selectors(), scalar_selectors(),
mpl::vector<wrapped_weight_t>()) mpl::vector<wrapped_weight_t>())
(deg1, deg2, weight); (deg1, deg2, weight);
} }
......
...@@ -418,6 +418,11 @@ struct vertex_scalar_selectors: ...@@ -418,6 +418,11 @@ struct vertex_scalar_selectors:
scalar_selector_type>::type {}; scalar_selector_type>::type {};
struct all_selectors: struct all_selectors:
mpl::transform<vertex_properties,
scalar_selector_type,
mpl::back_inserter<degree_selectors> >::type {};
struct scalar_selectors:
mpl::transform<vertex_scalar_properties, mpl::transform<vertex_scalar_properties,
scalar_selector_type, scalar_selector_type,
mpl::back_inserter<degree_selectors> >::type {}; mpl::back_inserter<degree_selectors> >::type {};
......
...@@ -31,7 +31,7 @@ get_vertex_average(GraphInterface& gi, GraphInterface::deg_t deg) ...@@ -31,7 +31,7 @@ get_vertex_average(GraphInterface& gi, GraphInterface::deg_t deg)
{ {
long double a, dev; long double a, dev;
run_action<>()(gi, get_average<VertexAverageTraverse>(a,dev), run_action<>()(gi, get_average<VertexAverageTraverse>(a,dev),
all_selectors())(degree_selector(deg)); scalar_selectors())(degree_selector(deg));
return python::make_tuple(a,dev); return python::make_tuple(a,dev);
} }
......
...@@ -35,7 +35,7 @@ get_vertex_histogram(GraphInterface& gi, GraphInterface::deg_t deg, ...@@ -35,7 +35,7 @@ get_vertex_histogram(GraphInterface& gi, GraphInterface::deg_t deg,
run_action<>()(gi, get_histogram<VertexHistogramFiller>(hist, bins, run_action<>()(gi, get_histogram<VertexHistogramFiller>(hist, bins,
ret_bins), ret_bins),
all_selectors())(degree_selector(deg)); scalar_selectors())(degree_selector(deg));
return python::make_tuple(hist, ret_bins); return python::make_tuple(hist, ret_bins);
} }
......
...@@ -39,7 +39,7 @@ find_vertex_range(GraphInterface& gi, GraphInterface::deg_t deg, ...@@ -39,7 +39,7 @@ find_vertex_range(GraphInterface& gi, GraphInterface::deg_t deg,
return ret; return ret;
} }
// find vertices which match a certain (inclusive) property range // find edges which match a certain (inclusive) property range
python::list python::list
find_edge_range(GraphInterface& gi, boost::any eprop, find_edge_range(GraphInterface& gi, boost::any eprop,
python::tuple range) python::tuple range)
......
Supports Markdown
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