source: src/graph/correlations/graph_avg_correlations_combined.cc @ 011d7b

Revision 011d7b, 1.9 KB checked in by Tiago de Paula Peixoto <tiago@…>, 2 years ago (diff)
Update copyright year
  • Property mode set to 100644
Line 
1// graph-tool -- a general graph modification and manipulation thingy
2//
3// Copyright (C) 2007-2011 Tiago de Paula Peixoto <tiago@skewed.de>
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 3
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18#include "graph_filtering.hh"
19
20#include <boost/python.hpp>
21
22#include "graph.hh"
23#include "graph_selectors.hh"
24#include "graph_properties.hh"
25
26#include "graph_avg_correlations.hh"
27
28#include <iostream>
29
30using namespace std;
31using namespace boost;
32using namespace graph_tool;
33
34typedef ConstantPropertyMap<int,GraphInterface::edge_t> dummy_weight;
35
36python::object
37get_vertex_avg_combined_correlation(GraphInterface& gi,
38                                    GraphInterface::deg_t deg1,
39                                    GraphInterface::deg_t deg2,
40                                    const vector<long double>& bins)
41{
42    python::object avg, dev;
43    python::object ret_bins;
44
45    run_action<>()(gi, get_avg_correlation<GetCombinedPair>
46                   (avg, dev, bins, ret_bins),
47                   scalar_selectors(), scalar_selectors(),
48                   mpl::vector<dummy_weight>())
49        (degree_selector(deg1), degree_selector(deg2), dummy_weight());
50    return python::make_tuple(avg, dev, ret_bins);
51}
52
53using namespace boost::python;
54
55void export_avg_combined_correlations()
56{
57    def("vertex_avg_combined_correlation",
58        &get_vertex_avg_combined_correlation);
59}
Note: See TracBrowser for help on using the repository browser.