...
 
Commits (3)
...@@ -21,10 +21,6 @@ ...@@ -21,10 +21,6 @@
#include <boost/graph/breadth_first_search.hpp> #include <boost/graph/breadth_first_search.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp> #include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/python/object.hpp>
#include <boost/python/list.hpp>
#include <boost/python/extract.hpp>
#include "histogram.hh" #include "histogram.hh"
#include "hash_map_wrap.hh" #include "hash_map_wrap.hh"
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#include "graph_avg_correlations.hh" #include "graph_avg_correlations.hh"
#include <iostream>
using namespace std; using namespace std;
using namespace boost; using namespace boost;
using namespace graph_tool; using namespace graph_tool;
......
...@@ -21,12 +21,8 @@ ...@@ -21,12 +21,8 @@
#include <algorithm> #include <algorithm>
#include <boost/numeric/conversion/bounds.hpp> #include <boost/numeric/conversion/bounds.hpp>
#include <boost/numeric/conversion/cast.hpp> #include <boost/numeric/conversion/cast.hpp>
#include <boost/python/object.hpp>
#include <boost/python/list.hpp>
#include <boost/python/extract.hpp>
#include "histogram.hh" #include "histogram.hh"
#include "numpy_bind.hh" #include "numpy_bind.hh"
#include "shared_map.hh"
namespace graph_tool namespace graph_tool
{ {
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "graph_filtering.hh" #include "graph_filtering.hh"
#include <boost/python.hpp> #include <boost/python.hpp>
#include <boost/utility/enable_if.hpp>
#include "graph_selectors.hh" #include "graph_selectors.hh"
#include "graph_properties.hh" #include "graph_properties.hh"
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "graph_selectors.hh" #include "graph_selectors.hh"
#include "graph_properties.hh" #include "graph_properties.hh"
#include <boost/mpl/quote.hpp>
#include <boost/graph/breadth_first_search.hpp> #include <boost/graph/breadth_first_search.hpp>
#include <cmath> #include <cmath>
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "graph.hh" #include "graph.hh"
#include "graph_filtering.hh" #include "graph_filtering.hh"
#include "graph_util.hh" #include "graph_util.hh"
#include "graph_python_interface.hh"
#ifdef _OPENMP #ifdef _OPENMP
#include <omp.h> #include <omp.h>
#endif #endif
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "graph_selectors.hh" #include "graph_selectors.hh"
#include "graph_properties.hh" #include "graph_properties.hh"
#include <boost/bind/placeholders.hpp>
#include <boost/mpl/push_back.hpp> #include <boost/mpl/push_back.hpp>
#include <boost/python.hpp> #include <boost/python.hpp>
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "graph_selectors.hh" #include "graph_selectors.hh"
#include "graph_properties.hh" #include "graph_properties.hh"
#include <boost/bind/placeholders.hpp>
#include <boost/mpl/push_back.hpp> #include <boost/mpl/push_back.hpp>
#include <boost/python.hpp> #include <boost/python.hpp>
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "graph_selectors.hh" #include "graph_selectors.hh"
#include "graph_properties.hh" #include "graph_properties.hh"
#include <boost/bind/placeholders.hpp>
#include <boost/mpl/push_back.hpp> #include <boost/mpl/push_back.hpp>
#include <boost/python.hpp> #include <boost/python.hpp>
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "graph_selectors.hh" #include "graph_selectors.hh"
#include "graph_properties.hh" #include "graph_properties.hh"
#include <boost/bind/placeholders.hpp>
#include <boost/mpl/push_back.hpp> #include <boost/mpl/push_back.hpp>
#include <boost/python.hpp> #include <boost/python.hpp>
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "graph_selectors.hh" #include "graph_selectors.hh"
#include "graph_properties.hh" #include "graph_properties.hh"
#include <boost/bind/placeholders.hpp>
#include <boost/mpl/push_back.hpp> #include <boost/mpl/push_back.hpp>
#include <boost/python.hpp> #include <boost/python.hpp>
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#include <tuple> #include <tuple>
#include <iostream> #include <iostream>
#include <boost/functional/hash.hpp>
#include <boost/multi_array.hpp>
#include "graph.hh" #include "graph.hh"
#include "graph_filtering.hh" #include "graph_filtering.hh"
......
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
#include "graph_union.hh" #include "graph_union.hh"
#include <boost/python/extract.hpp>
using namespace graph_tool; using namespace graph_tool;
using namespace boost; using namespace boost;
......
...@@ -20,9 +20,6 @@ ...@@ -20,9 +20,6 @@
#include "graph_union.hh" #include "graph_union.hh"
#include <boost/python/extract.hpp>
using namespace graph_tool; using namespace graph_tool;
using namespace boost; using namespace boost;
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <boost/variant/get.hpp> #include <boost/variant/get.hpp>
#include <boost/spirit/include/support_istream_iterator.hpp> #include <boost/spirit/include/support_istream_iterator.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/type_traits.hpp>
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
...@@ -44,7 +43,6 @@ ...@@ -44,7 +43,6 @@
#include <fstream> #include <fstream>
#include <string> #include <string>
#include <vector> #include <vector>
#include <unordered_map> #include <unordered_map>
#include "base64.hh" #include "base64.hh"
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include <boost/lambda/lambda.hpp> #include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp> #include <boost/lambda/bind.hpp>
#include <iostream>
using namespace std; using namespace std;
using namespace boost; using namespace boost;
......
...@@ -19,11 +19,11 @@ ...@@ -19,11 +19,11 @@
#define GRAPH_HH #define GRAPH_HH
#include "config.h" #include "config.h"
#include <Python.h>
#include <boost/python/object.hpp> #include <boost/python/object.hpp>
#include <boost/python/dict.hpp> #include <boost/python/list.hpp>
#include <boost/python/tuple.hpp>
#include <deque> #include <boost/any.hpp>
#include "graph_adjacency.hh" #include "graph_adjacency.hh"
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include "fast_vector_property_map.hh" #include "fast_vector_property_map.hh"
#include <boost/variant.hpp> #include <boost/variant.hpp>
#include <boost/mpl/vector.hpp> #include <boost/mpl/bool_fwd.hpp>
#include "graph_properties.hh" #include "graph_properties.hh"
#include "graph_exceptions.hh" #include "graph_exceptions.hh"
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <deque> #include <deque>
#include <utility> #include <utility>
#include <numeric> #include <numeric>
#include <iostream>
#include <tuple> #include <tuple>
#include <boost/iterator.hpp> #include <boost/iterator.hpp>
#include <boost/graph/graph_traits.hpp> #include <boost/graph/graph_traits.hpp>
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "graph_selectors.hh" #include "graph_selectors.hh"
#include <boost/mpl/for_each.hpp> #include <boost/mpl/for_each.hpp>
#include <boost/mpl/contains.hpp>
#include <boost/python/extract.hpp> #include <boost/python/extract.hpp>
using namespace std; using namespace std;
......
...@@ -22,31 +22,14 @@ ...@@ -22,31 +22,14 @@
#include <boost/version.hpp> #include <boost/version.hpp>
#include <boost/graph/graph_traits.hpp> #include <boost/graph/graph_traits.hpp>
#include <boost/mpl/vector.hpp> #include <boost/mpl/vector.hpp>
#include <boost/mpl/erase.hpp>
#include <boost/mpl/clear.hpp>
#include <boost/mpl/map.hpp>
#include <boost/mpl/for_each.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/or.hpp>
#include <boost/mpl/if.hpp> #include <boost/mpl/if.hpp>
#include <boost/mpl/logical.hpp> #include <boost/mpl/logical.hpp>
#include <boost/mpl/inserter.hpp> #include <boost/mpl/back_inserter.hpp>
#include <boost/mpl/insert_range.hpp>
#include <boost/mpl/assert.hpp> #include <boost/mpl/assert.hpp>
#include <boost/mpl/plus.hpp>
#include <boost/mpl/divides.hpp>
#include <boost/mpl/arithmetic.hpp>
#include <boost/mpl/greater_equal.hpp>
#include <boost/mpl/comparison.hpp>
#include <boost/mpl/transform_view.hpp>
#include <boost/mpl/quote.hpp>
#include <boost/mpl/range_c.hpp>
#include <boost/mpl/print.hpp>
#include "graph_adaptor.hh" #include "graph_adaptor.hh"
#include "graph_filtered.hh" #include "graph_filtered.hh"
#include "graph_reverse.hh" #include "graph_reverse.hh"
#include "graph_selectors.hh"
#include "graph_util.hh" #include "graph_util.hh"
#include "mpl_nested_loop.hh" #include "mpl_nested_loop.hh"
...@@ -440,9 +423,83 @@ struct action_wrap ...@@ -440,9 +423,83 @@ struct action_wrap
Action _a; Action _a;
}; };
// this takes a functor and type ranges and iterates through the type //
// combinations when called with boost::any parameters, and calls the correct // action_dispatch machinery
// function //
// a lightweight class for holding a list of types
template <class... T>
struct typelist {};
template <class... T>
constexpr auto to_typelist(std::tuple<T...>) -> typelist<T...>;
template <class Tuple>
using to_typelist_t = decltype(to_typelist(std::declval<Tuple>()));
// handling one typelist/value
// select a binding from the current list
template<class F, // function to bind
class... Ts, // current typelist
class... TRS, // remaining typelists
class Arg,
class... Args>
bool dispatch_loop(F f,
typelist<typelist<Ts...>, TRS...>,
Arg&& arg,
Args&&... args) // remaining args
{
using namespace boost::mpl;
// determine which one of the Ts we are looking at
// then recurse with the first argument of F bound accordingly
void *farg; // pointer to extracted value from boost::any
// we always will know what its type is
if constexpr (sizeof...(TRS) == 0)
{
// just one argument remains to be bound
return (
// iterate over types, trying each
((farg = boost::any_cast<Ts>(&arg))
? (f(*static_cast<Ts*>(farg)), true)
// try reference_wrapper instead
: ((farg = boost::any_cast<std::reference_wrapper<Ts>>(&arg))
? (f(static_cast<std::reference_wrapper<Ts>*>(farg)->get()), true)
: false)) || ...);
}
else
{
// helper function for setting up recursion
auto dl =
[f = std::move(f)](auto * a, // extracted value from boost::any
auto&&... args) // boost::any's yet to be processed
{
// create the new F with N-1 arguments
return dispatch_loop
([f = std::move(f), a](auto &&... fargs){
f(*a,
std::forward<decltype(fargs)>(fargs)...);
},
typelist<TRS...>{},
std::forward<decltype(args)>(args)...);
};
return (
((farg = boost::any_cast<Ts>(&arg))
? dl(static_cast<Ts*>(farg),
std::forward<Args>(args)...)
: ((farg = boost::any_cast<std::reference_wrapper<Ts>>(&arg))
? dl(&static_cast<std::reference_wrapper<Ts>*>(farg)->get(),
std::forward<Args>(args)...)
: false))
|| ...); // iterate over Ts...
}
}
// this takes a functor and type ranges, locates the correct combination
// from the boost::any parameters, and calls the correct function
template <class Action, class Wrap, class... TRS> template <class Action, class Wrap, class... TRS>
struct action_dispatch struct action_dispatch
{ {
...@@ -451,8 +508,11 @@ struct action_dispatch ...@@ -451,8 +508,11 @@ struct action_dispatch
template <class... Args> template <class... Args>
void operator()(Args&&... args) const void operator()(Args&&... args) const
{ {
bool found = using namespace boost::mpl;
boost::mpl::nested_for_each<TRS...>(_a, std::forward<Args>(args)...);
bool found = dispatch_loop(_a, typelist<to_typelist_t<to_tuple_t<TRS>>...>{},
std::forward<Args>(args)...);
if (!found) if (!found)
{ {
std::vector<const std::type_info*> args_t = {(&(args).type())...}; std::vector<const std::type_info*> args_t = {(&(args).type())...};
......
...@@ -22,8 +22,7 @@ ...@@ -22,8 +22,7 @@
#include <boost/iostreams/filtering_stream.hpp> #include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/gzip.hpp> #include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/filter/bzip2.hpp> #include <boost/iostreams/filter/bzip2.hpp>
#include <boost/iostreams/device/file_descriptor.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/iostreams/device/file.hpp>
#include <boost/graph/graphml.hpp> #include <boost/graph/graphml.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <boost/xpressive/xpressive.hpp> #include <boost/xpressive/xpressive.hpp>
......
...@@ -26,24 +26,22 @@ ...@@ -26,24 +26,22 @@
#include <boost/functional/hash.hpp> #include <boost/functional/hash.hpp>
#include <boost/python/object.hpp> #include <boost/python/object.hpp>
#include <boost/python/extract.hpp> #include <boost/python/extract.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/version.hpp> #include <boost/version.hpp>
#if (BOOST_VERSION >= 104000) #if (BOOST_VERSION >= 104000)
# include <boost/property_map/property_map.hpp> # include <boost/property_map/property_map.hpp>
# include <boost/property_map/dynamic_property_map.hpp>
#else #else
# include <boost/property_map.hpp> # include <boost/property_map.hpp>
# include <boost/dynamic_property_map.hpp>
#endif #endif
#include "fast_vector_property_map.hh" #include "fast_vector_property_map.hh"
#include <boost/mpl/vector.hpp> #include <boost/mpl/vector.hpp>
#include <boost/mpl/for_each.hpp> #include <boost/mpl/for_each.hpp>
#include <boost/mpl/transform.hpp> #include <boost/mpl/transform.hpp>
#include <boost/mpl/find.hpp> #include <boost/mpl/find.hpp>
#include <boost/mpl/bind.hpp>
#include "graph.hh"
#include "graph_exceptions.hh" #include "graph_exceptions.hh"
#include "hash_map_wrap.hh"
// this file provides general functions for manipulating graph properties // this file provides general functions for manipulating graph properties
......
...@@ -19,9 +19,6 @@ ...@@ -19,9 +19,6 @@
#include "graph_filtering.hh" #include "graph_filtering.hh"
#include "graph_properties.hh" #include "graph_properties.hh"
#include <boost/mpl/contains.hpp>
#include <boost/python/extract.hpp>
#include "graph_properties_copy.hh" #include "graph_properties_copy.hh"
using namespace std; using namespace std;
......
...@@ -22,9 +22,7 @@ ...@@ -22,9 +22,7 @@
#include "graph_filtering.hh" #include "graph_filtering.hh"
#include "graph_properties.hh" #include "graph_properties.hh"
#include "graph_util.hh" #include "graph_util.hh"
#include "hash_map_wrap.hh"
#include <boost/mpl/contains.hpp>
#include <boost/python/extract.hpp>
namespace graph_tool namespace graph_tool
{ {
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
#include "graph_properties_group.hh" #include "graph_properties_group.hh"
#include <boost/python/extract.hpp>
using namespace std; using namespace std;
using namespace boost; using namespace boost;
using namespace graph_tool; using namespace graph_tool;
......
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
#include "graph_util.hh" #include "graph_util.hh"
#include "hash_map_wrap.hh" #include "hash_map_wrap.hh"
#include <boost/mpl/for_each.hpp>
#include <boost/python/extract.hpp> #include <boost/python/extract.hpp>
using namespace std; using namespace std;
......
...@@ -23,10 +23,6 @@ ...@@ -23,10 +23,6 @@
#include "graph_util.hh" #include "graph_util.hh"
#include "hash_map_wrap.hh" #include "hash_map_wrap.hh"
#include <boost/mpl/for_each.hpp>
#include <boost/python/extract.hpp>
using namespace std; using namespace std;
using namespace boost; using namespace boost;
using namespace graph_tool; using namespace graph_tool;
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
#include "graph_properties_group.hh" #include "graph_properties_group.hh"
#include <boost/python/extract.hpp>
using namespace std; using namespace std;
using namespace boost; using namespace boost;
using namespace graph_tool; using namespace graph_tool;
......
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
#include "graph_python_interface.hh" #include "graph_python_interface.hh"
#include <boost/python.hpp> #include <boost/python.hpp>
#include <boost/python/stl_iterator.hpp>
#include <set>
#include "coroutine.hh" #include "coroutine.hh"
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#define PYTHON_INTERFACE_HH #define PYTHON_INTERFACE_HH
#include <boost/python.hpp> #include <boost/python.hpp>
#include <boost/python/type_id.hpp>
namespace std namespace std
{ {
...@@ -37,6 +36,12 @@ namespace std ...@@ -37,6 +36,12 @@ namespace std
#include <boost/mpl/logical.hpp> #include <boost/mpl/logical.hpp>
#include <boost/iterator/iterator_facade.hpp> #include <boost/iterator/iterator_facade.hpp>
#include <boost/version.hpp>
#if (BOOST_VERSION >= 104000)
# include <boost/property_map/dynamic_property_map.hpp>
#else
# include <boost/dynamic_property_map.hpp>
#endif
#include <type_traits> #include <type_traits>
#include "graph.hh" #include "graph.hh"
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "demangle.hh" #include "demangle.hh"
#include <boost/python.hpp> #include <boost/python.hpp>
#include <boost/lambda/bind.hpp>
using namespace std; using namespace std;
using namespace boost; using namespace boost;
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "graph.hh" #include "graph.hh"
#include "graph_util.hh" #include "graph_util.hh"
#include "graph_python_interface.hh" #include "graph_python_interface.hh"
#include "hash_map_wrap.hh"
#include <boost/python.hpp> #include <boost/python.hpp>
#include <boost/python/stl_iterator.hpp> #include <boost/python/stl_iterator.hpp>
......
...@@ -26,9 +26,8 @@ ...@@ -26,9 +26,8 @@
#include <boost/graph/adjacency_iterator.hpp> #include <boost/graph/adjacency_iterator.hpp>
#include <boost/graph/properties.hpp> #include <boost/graph/properties.hpp>
#include <boost/iterator/transform_iterator.hpp> #include <boost/iterator/transform_iterator.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/type_traits.hpp>
#include <boost/mpl/if.hpp> #include <boost/mpl/if.hpp>
#include <utility>
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
// Stay out of the way of the concept checking class // Stay out of the way of the concept checking class
......
...@@ -24,11 +24,12 @@ ...@@ -24,11 +24,12 @@
#include <boost/mpl/map.hpp> #include <boost/mpl/map.hpp>
#include <boost/mpl/at.hpp> #include <boost/mpl/at.hpp>
#include <boost/mpl/vector.hpp> #include <boost/mpl/vector.hpp>
#include <boost/mpl/find.hpp> #include <boost/mpl/transform.hpp>
#include <boost/mpl/not.hpp> #include <boost/mpl/assert.hpp>
#include <boost/mpl/logical.hpp> #include <boost/mpl/back_inserter.hpp>
#include <boost/any.hpp>
#include <boost/graph/graph_traits.hpp>
#include "graph_adaptor.hh"
#include "graph_properties.hh" #include "graph_properties.hh"
#include "graph.hh" #include "graph.hh"
......
...@@ -30,13 +30,9 @@ namespace boost { namespace python { namespace detail { ...@@ -30,13 +30,9 @@ namespace boost { namespace python { namespace detail {
} } } } } }
#include <boost/graph/graph_traits.hpp> #include <boost/graph/graph_traits.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/split.hpp> #include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/trim.hpp> #include <boost/algorithm/string/trim.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <string> #include <string>
#include <boost/functional/hash.hpp> #include <boost/functional/hash.hpp>
...@@ -44,7 +40,6 @@ namespace boost { namespace python { namespace detail { ...@@ -44,7 +40,6 @@ namespace boost { namespace python { namespace detail {
#include <random> #include <random>
#include "graph_selectors.hh" #include "graph_selectors.hh"
#include "graph_reverse.hh"
#include "graph_filtered.hh" #include "graph_filtered.hh"
namespace graph_tool namespace graph_tool
......
...@@ -10,13 +10,11 @@ ...@@ -10,13 +10,11 @@
// Tiago de Paula Peixoto // Tiago de Paula Peixoto
#include <boost/python.hpp> #include <boost/python.hpp>
#include <boost/variant.hpp>
#include <expat.h> #include <expat.h>
#include <boost/graph/graphml.hpp> #include <boost/graph/graphml.hpp>
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
#include <boost/archive/iterators/xml_escape.hpp> #include <boost/archive/iterators/xml_escape.hpp>
#include <boost/archive/iterators/ostream_iterator.hpp> #include <boost/archive/iterators/ostream_iterator.hpp>
#include <boost/archive/iterators/insert_linebreaks.hpp>
#include <sstream> #include <sstream>
#include "base64.hh" #include "base64.hh"
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#define BOOST_DISABLE_ASSERTS #define BOOST_DISABLE_ASSERTS
#include <boost/multi_array.hpp> #include <boost/multi_array.hpp>
#include <boost/type_traits.hpp>
#include <boost/mpl/if.hpp> #include <boost/mpl/if.hpp>
#include <boost/mpl/int.hpp> #include <boost/mpl/int.hpp>
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include "../support/util.hh" #include "../support/util.hh"
#include "../support/int_part.hh" #include "../support/int_part.hh"
#include "hash_map_wrap.hh"
namespace graph_tool namespace graph_tool
{ {
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include "graph_latent_multigraph.hh" #include "graph_latent_multigraph.hh"
#include <boost/mpl/push_back.hpp>
#include <boost/python.hpp> #include <boost/python.hpp>
using namespace std; using namespace std;
......
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
#include <vector> #include <vector>
#include <cmath> #include <cmath>
#include <boost/math/special_functions/gamma.hpp>
namespace graph_tool namespace graph_tool
{ {
using namespace std; using namespace std;
......
...@@ -15,9 +15,6 @@ ...@@ -15,9 +15,6 @@
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <boost/math/special_functions/zeta.hpp>
#include <boost/math/special_functions/gamma.hpp>
#include "graph_tool.hh" #include "graph_tool.hh"
#include "hash_map_wrap.hh" #include "hash_map_wrap.hh"
#include "int_part.hh" #include "int_part.hh"
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "graph_tool.hh" #include "graph_tool.hh"
#include "../support/graph_state.hh" #include "../support/graph_state.hh"
#include "graph_blockmodel_dynamics.hh" #include "graph_blockmodel_dynamics.hh"
#include "graph_python_interface.hh"
namespace graph_tool namespace graph_tool
{ {
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
#include "graph.hh" #include "graph.hh"
#include "graph_properties.hh" #include "graph_properties.hh"
#include <boost/lambda/bind.hpp>
#include "graph_arf.hh" #include "graph_arf.hh"
using namespace std; using namespace std;
......
...@@ -31,10 +31,6 @@ Value power(Value value, int n) ...@@ -31,10 +31,6 @@ Value power(Value value, int n)
} }
#endif #endif
#include <boost/math/special_functions/gamma.hpp>
#include <boost/math/special_functions/hypot.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/graph/fruchterman_reingold.hpp> #include <boost/graph/fruchterman_reingold.hpp>
using namespace std; using namespace std;
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#include "graph_properties.hh" #include "graph_properties.hh"
#include "graph_exceptions.hh" #include "graph_exceptions.hh"
#include <boost/lambda/bind.hpp>
#include "graph_sfdp.hh" #include "graph_sfdp.hh"
#include "random.hh" #include "random.hh"
#include "hash_map_wrap.hh" #include "hash_map_wrap.hh"
......
...@@ -63,55 +63,6 @@ namespace mpl ...@@ -63,55 +63,6 @@ namespace mpl
// of arguments according to the called types. If the cast is successful, the // of arguments according to the called types. If the cast is successful, the
// function will be called with those types, and true will be returned. // function will be called with those types, and true will be returned.
template <class Action, std::size_t N>
struct all_any_cast
{
all_any_cast(Action a, std::array<any*, N>& args)
: _a(a), _args(args) {}
template <class... Ts>
[[gnu::always_inline]]
bool operator()(Ts*... vs) const
{
return dispatch(std::make_index_sequence<sizeof...(Ts)>(), vs...);
}
template <class T>
T* try_any_cast(boost::any& a) const
{
T* t = any_cast<T>(&a);
if (t != nullptr)
return t;
std::reference_wrapper<T>* tr = any_cast<std::reference_wrapper<T>>(&a);
if (tr != nullptr)
return &(tr->get());
return nullptr;
}
template <std::size_t... Idx, class... Ts>
[[gnu::always_inline]]
bool dispatch(std::index_sequence<Idx...>, Ts*...) const
{
static_assert(sizeof...(Idx) == N,
"all_any_cast: wrong number of arguments");
std::tuple<std::add_pointer_t<Ts>...> args;
if (((std::get<Idx>(args) = try_any_cast<Ts>(*_args[Idx])) && ...))
{
// successful set of casts. Dereference and call action.
std::apply([this](auto*... arg){ _a(*arg...); }, args);
return true;
}
return false;
}
Action _a;
std::array<any*, N>& _args;
};
// recursion-free variadic version of for_each // recursion-free variadic version of for_each
template <class...> template <class...>
struct for_each_variadic; struct for_each_variadic;
...@@ -143,6 +94,9 @@ struct to_tuple ...@@ -143,6 +94,9 @@ struct to_tuple
to_tuple_imp<mpl::_1, mpl::_2>>::type type; to_tuple_imp<mpl::_1, mpl::_2>>::type type;
}; };
template <class Seq>
using to_tuple_t = typename to_tuple<Seq>::type;
// nested type loops via variadic templates // nested type loops via variadic templates
template <class...> template <class...>
...@@ -179,17 +133,6 @@ struct inner_loop<Action, std::tuple<Ts...>, TR1, TRS...> ...@@ -179,17 +133,6 @@ struct inner_loop<Action, std::tuple<Ts...>, TR1, TRS...>
// final function // final function
template <class TR1, class... TRS, class Action, class... Args>
bool nested_for_each(Action a, Args&&... args)
{
std::array<any*, sizeof...(args)> as{{&args...}};
auto b = all_any_cast<Action, sizeof...(args)>(a, as);
typedef decltype(b) action_t;
typedef typename to_tuple<TR1>::type tr_tuple;
typedef inner_loop<action_t, std::tuple<>, TRS...> inner_loop_t;
return for_each_variadic<inner_loop_t, tr_tuple>()(inner_loop_t(b));
}
template <class TR1, class... TRS, class Action> template <class TR1, class... TRS, class Action>
void nested_for_each(Action a) void nested_for_each(Action a)
{ {
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#define BOOST_DISABLE_ASSERTS #define BOOST_DISABLE_ASSERTS
#include <boost/multi_array.hpp> #include <boost/multi_array.hpp>
#include <boost/type_traits.hpp>
#include <boost/mpl/int.hpp> #include <boost/mpl/int.hpp>
#include <boost/mpl/vector.hpp> #include <boost/mpl/vector.hpp>
#include <boost/mpl/map.hpp> #include <boost/mpl/map.hpp>
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
// Ronald Garcia // Ronald Garcia
// //
#include <boost/ref.hpp>
#include <boost/function/function2.hpp>
#include <boost/version.hpp> #include <boost/version.hpp>
#if (BOOST_VERSION >= 104000) #if (BOOST_VERSION >= 104000)
# include <boost/property_map/dynamic_property_map.hpp> # include <boost/property_map/dynamic_property_map.hpp>
...@@ -47,8 +45,6 @@ ...@@ -47,8 +45,6 @@
#include <cstdlib> #include <cstdlib>
#include <boost/throw_exception.hpp> #include <boost/throw_exception.hpp>
#include <boost/regex.hpp> #include <boost/regex.hpp>
#include <boost/function.hpp>
#include <boost/bind.hpp>
#include <boost/graph/graphviz.hpp> #include <boost/graph/graphviz.hpp>
namespace boost { namespace boost {
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "graph_astar.hh" #include "graph_astar.hh"
#include "coroutine.hh" #include "coroutine.hh"
#include "graph_python_interface.hh"
using namespace std; using namespace std;
using namespace boost; using namespace boost;
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "graph_filtering.hh" #include "graph_filtering.hh"
#include "graph_python_interface.hh"
#include <boost/python.hpp> #include <boost/python.hpp>
#include <boost/graph/astar_search.hpp> #include <boost/graph/astar_search.hpp>
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "graph_util.hh" #include "graph_util.hh"
#include "coroutine.hh" #include "coroutine.hh"
#include "graph_python_interface.hh"
using namespace std; using namespace std;
using namespace boost; using namespace boost;
......
...@@ -10,14 +10,12 @@ ...@@ -10,14 +10,12 @@
#include <boost/python.hpp> #include <boost/python.hpp>
#include <boost/graph/depth_first_search.hpp> #include <boost/graph/depth_first_search.hpp>
#include <boost/graph/undirected_dfs.hpp>
#include "graph.hh" #include "graph.hh"
#include "graph_selectors.hh" #include "graph_selectors.hh"
#include "graph_util.hh" #include "graph_util.hh"
#include "coroutine.hh" #include "coroutine.hh"
#include "graph_python_interface.hh"
using namespace std; using namespace std;
using namespace boost; using namespace boost;
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "graph_util.hh" #include "graph_util.hh"
#include "coroutine.hh" #include "coroutine.hh"
#include "graph_python_interface.hh"
using namespace std; using namespace std;
using namespace boost; using namespace boost;
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
#define GRAPH_AVERAGE_HH #define GRAPH_AVERAGE_HH
#include <algorithm> #include <algorithm>
#include <boost/numeric/conversion/bounds.hpp>
#include <boost/numeric/conversion/cast.hpp>
namespace graph_tool namespace graph_tool
{ {
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <boost/python/object.hpp> #include <boost/python/object.hpp>
#include <boost/python/list.hpp> #include <boost/python/list.hpp>
#include <boost/python/extract.hpp>
#include "histogram.hh" #include "histogram.hh"
#include "numpy_bind.hh" #include "numpy_bind.hh"
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <boost/python/object.hpp> #include <boost/python/object.hpp>
#include <boost/python/list.hpp> #include <boost/python/list.hpp>
#include <boost/python/extract.hpp>
#include "histogram.hh" #include "histogram.hh"
#include "numpy_bind.hh" #include "numpy_bind.hh"
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
#include <boost/numeric/conversion/bounds.hpp> #include <boost/numeric/conversion/bounds.hpp>
#include <boost/numeric/conversion/cast.hpp> #include <boost/numeric/conversion/cast.hpp>
#include <boost/python/object.hpp> #include <boost/python/object.hpp>
#include <boost/python/list.hpp>
#include <boost/python/extract.hpp>
#include "numpy_bind.hh" #include "numpy_bind.hh"
#include "histogram.hh" #include "histogram.hh"
#include "shared_map.hh" #include "shared_map.hh"
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
#include "graph_util.hh" #include "graph_util.hh"
#include "idx_map.hh" #include "idx_map.hh"
#include <boost/range/adaptor/reversed.hpp>
namespace graph_tool namespace graph_tool
{ {
using namespace std; using namespace std;
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <boost/graph/dijkstra_shortest_paths_no_color_map.hpp> #include <boost/graph/dijkstra_shortest_paths_no_color_map.hpp>
#include <boost/graph/bellman_ford_shortest_paths.hpp> #include <boost/graph/bellman_ford_shortest_paths.hpp>
#include <boost/graph/dag_shortest_paths.hpp> #include <boost/graph/dag_shortest_paths.hpp>
#include <boost/python/stl_iterator.hpp>
#include <boost/python.hpp> #include <boost/python.hpp>
#if (BOOST_VERSION >= 106000) #if (BOOST_VERSION >= 106000)
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include <array> #include <array>
#include <deque> #include <deque>
#include "hash_map_wrap.hh"
namespace graph_tool namespace graph_tool
{ {
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#ifdef _OPENMP #ifdef _OPENMP
#include <omp.h> #include <omp.h>
#include <boost/type_traits.hpp>
#endif #endif
......