source: src/graph/centrality/graph_pagerank.cc @ 7fb5d7

Revision 7fb5d7, 1.6 KB checked in by Tiago de Paula Peixoto <tiago@…>, 4 years ago (diff)
Dump lambda::bind in favor of boost::bind This is a large commit which replaces lambda::bind with boost::bind in most parts of the code. This improves compilation time, and slightly decreases compilation memory usage in some cases.
  • Property mode set to 100644
Line 
1// graph-tool -- a general graph modification and manipulation thingy
2//
3// Copyright (C) 2007  Tiago de Paula Peixoto <tiago@forked.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#include <boost/lambda/bind.hpp>
22
23#include "graph.hh"
24#include "graph_selectors.hh"
25#include "graph_pagerank.hh"
26
27using namespace std;
28using namespace boost;
29using namespace graph_tool;
30
31size_t pagerank(GraphInterface& g, boost::any rank, double d, double epslon,
32                size_t max_iter)
33{
34    if (!belongs<writable_vertex_scalar_properties>()(rank))
35        throw ValueException("vertex property must be writable");
36
37    size_t iter;
38    run_action<>()
39        (g, bind<void>(get_pagerank(),
40                       _1, g.GetVertexIndex(),  _2, d,
41                       epslon, max_iter, ref(iter)),
42         writable_vertex_scalar_properties())(rank);
43    return iter;
44}
45
46
47void export_pagerank()
48{
49    using namespace boost::python;
50    def("get_pagerank", &pagerank);
51}
Note: See TracBrowser for help on using the repository browser.