graph_bind.cc 17 KB
Newer Older
Tiago Peixoto's avatar
Tiago Peixoto committed
1
2
// graph-tool -- a general graph modification and manipulation thingy
//
Tiago Peixoto's avatar
Tiago Peixoto committed
3
// Copyright (C) 2006-2015 Tiago de Paula Peixoto <tiago@skewed.de>
Tiago Peixoto's avatar
Tiago Peixoto committed
4
5
6
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
Tiago Peixoto's avatar
Tiago Peixoto committed
7
// as published by the Free Software Foundation; either version 3
Tiago Peixoto's avatar
Tiago Peixoto committed
8
9
10
11
12
13
14
15
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
16
17
// along with this program. If not, see <http://www.gnu.org/licenses/>.

18
#define NUMPY_EXPORT
19
20
21
#include "numpy_bind.hh"

#include "graph.hh"
22
#include "graph_util.hh"
Tiago Peixoto's avatar
Tiago Peixoto committed
23
#include "graph_python_interface.hh"
Tiago Peixoto's avatar
Tiago Peixoto committed
24

25
26
#include "random.hh"

Tiago Peixoto's avatar
Tiago Peixoto committed
27
28
#ifdef HAVE_SCIPY // integration with scipy weave
#include "weave/scxx/object.h"
29
30
31
32
#include "weave/scxx/list.h"
#include "weave/scxx/tuple.h"
#include "weave/scxx/dict.h"
#include "weave/scxx/str.h"
Tiago Peixoto's avatar
Tiago Peixoto committed
33
34
#endif

Tiago Peixoto's avatar
Tiago Peixoto committed
35
36
37
38
#include <boost/python.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
#include "bytesobject.h"

Tiago Peixoto's avatar
Tiago Peixoto committed
39
40
41
42
43
using namespace std;
using namespace graph_tool;
using namespace boost;
using namespace boost::python;

44
struct LibInfo
Tiago Peixoto's avatar
Tiago Peixoto committed
45
{
46
47
48
49
50
51
    string GetName()      const {return PACKAGE_NAME;}
    string GetAuthor()    const {return AUTHOR;}
    string GetCopyright() const {return COPYRIGHT;}
    string GetVersion()   const {return VERSION " (commit " GIT_COMMIT
                                        ", " GIT_COMMIT_DATE ")";}
    string GetLicense()   const {return "GPL version 3 or above";}
Tiago Peixoto's avatar
Tiago Peixoto committed
52
    string GetCXXFLAGS()  const {return CPPFLAGS " " CXXFLAGS " " LDFLAGS;}
53
54
    string GetInstallPrefix() const {return INSTALL_PREFIX;}
    string GetPythonDir() const {return PYTHON_DIR;}
Tiago Peixoto's avatar
Tiago Peixoto committed
55
56
57
58
59
60
    string GetGCCVersion() const
    {
        stringstream s;
        s << __GNUC__ << "." << __GNUC_MINOR__ << "." <<  __GNUC_PATCHLEVEL__;
        return s.str();
    }
Tiago Peixoto's avatar
Tiago Peixoto committed
61
62
};

63

64
65
template <class ValueType>
struct vector_from_list
Tiago Peixoto's avatar
Tiago Peixoto committed
66
{
67
    vector_from_list()
Tiago Peixoto's avatar
Tiago Peixoto committed
68
    {
Tiago Peixoto's avatar
Tiago Peixoto committed
69
         boost::python::converter::registry::push_back
70
            (&convertible, &construct,
71
             boost::python::type_id<vector<ValueType> >());
Tiago Peixoto's avatar
Tiago Peixoto committed
72
73
74
75
    }

    static void* convertible(PyObject* obj_ptr)
    {
76
77
        handle<> x(borrowed(obj_ptr));
        object o(x);
78
79
80
81
82
83
84
        size_t N = len(o);
        for (size_t i = 0; i < N; ++i)
        {
            extract<ValueType> elem(o[i]);
            if (!elem.check())
                return 0;
        }
85
        return obj_ptr;
Tiago Peixoto's avatar
Tiago Peixoto committed
86
87
    }

88
    static void construct(PyObject* obj_ptr,
Tiago Peixoto's avatar
Tiago Peixoto committed
89
                          boost::python::converter::rvalue_from_python_stage1_data* data)
90
    {
91
92
        handle<> x(borrowed(obj_ptr));
        object o(x);
93
94
95
        vector<ValueType> value;
        size_t N = len(o);
        for (size_t i = 0; i < N; ++i)
96
            value.push_back(extract<ValueType>(o[i])());
97
        void* storage =
98
            ( (boost::python::converter::rvalue_from_python_storage
99
100
               <vector<ValueType> >*) data)->storage.bytes;
        new (storage) vector<ValueType>(value);
101
        data->convertible = storage;
Tiago Peixoto's avatar
Tiago Peixoto committed
102
103
104
    }
};

105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
template <class ValueType>
bool vector_equal_compare(const vector<ValueType>& v1,
                          const vector<ValueType>& v2)
{
    if (v1.size() != v2.size())
        return false;
    for (size_t i = 0; i < v1.size(); ++i)
    {
        if (v1[i] != v2[i])
            return false;
    }
    return true;
}

template <class ValueType>
bool vector_nequal_compare(const vector<ValueType>& v1,
                           const vector<ValueType>& v2)
{
    return !vector_equal_compare(v1,v2);
}

126
struct export_vector_types
Tiago Peixoto's avatar
Tiago Peixoto committed
127
{
128
129
    template <class ValueType>
    void operator()(ValueType) const
Tiago Peixoto's avatar
Tiago Peixoto committed
130
    {
131
132
133
134
        string type_name = get_type_name<>()(typeid(ValueType));
        if (type_name == "long double")
            type_name = "long_double";
        string name = "Vector_" + type_name;
135
136
        class_<vector<ValueType> > vc(name.c_str());
        vc.def(vector_indexing_suite<vector<ValueType> >())
137
138
            .def("__eq__", &vector_equal_compare<ValueType>)
            .def("__ne__", &vector_nequal_compare<ValueType>);
Tiago Peixoto's avatar
Tiago Peixoto committed
139
        wrap_array(vc, typename boost::mpl::has_key<numpy_types,ValueType>::type());
140
        vector_from_list<ValueType>();
Tiago Peixoto's avatar
Tiago Peixoto committed
141
    }
142
143

    template <class ValueType>
Tiago Peixoto's avatar
Tiago Peixoto committed
144
    void wrap_array(class_<vector<ValueType> >& vc, boost::mpl::true_) const
145
146
147
148
149
    {
        vc.def("get_array", &wrap_vector_not_owned<ValueType>);
    }

    template <class ValueType>
Tiago Peixoto's avatar
Tiago Peixoto committed
150
    void wrap_array(class_<vector<ValueType> >& vc, boost::mpl::false_) const
151
152
    {
    }
153
};
Tiago Peixoto's avatar
Tiago Peixoto committed
154

155
156
// exception translation
template <class Exception>
Tiago Peixoto's avatar
Tiago Peixoto committed
157
void graph_exception_translator(const Exception& e)
158
{
Tiago Peixoto's avatar
Tiago Peixoto committed
159
    PyObject* error;
Tiago Peixoto's avatar
Tiago Peixoto committed
160
    if (std::is_same<Exception, GraphException>::value)
Tiago Peixoto's avatar
Tiago Peixoto committed
161
        error = PyExc_RuntimeError;
Tiago Peixoto's avatar
Tiago Peixoto committed
162
    if (std::is_same<Exception, IOException>::value)
Tiago Peixoto's avatar
Tiago Peixoto committed
163
        error = PyExc_IOError;
Tiago Peixoto's avatar
Tiago Peixoto committed
164
    if (std::is_same<Exception, ValueException>::value)
Tiago Peixoto's avatar
Tiago Peixoto committed
165
166
        error = PyExc_ValueError;

167
    PyObject* message = PyUnicode_FromString(e.what());
Tiago Peixoto's avatar
Tiago Peixoto committed
168
169
    PyObject_SetAttrString(error, "message", message);
    PyErr_SetString(error, e.what());
170
}
Tiago Peixoto's avatar
Tiago Peixoto committed
171

172
173
174
175
void raise_error(const string& msg)
{
    throw GraphException(msg);
}
Tiago Peixoto's avatar
Tiago Peixoto committed
176

177
178
template <class T1, class T2>
struct pair_to_tuple
Tiago Peixoto's avatar
Tiago Peixoto committed
179
{
180
    static PyObject* convert(const pair<T1,T2>& p)
Tiago Peixoto's avatar
Tiago Peixoto committed
181
    {
182
183
        boost::python::tuple t = boost::python::make_tuple(p.first,p.second);
        return incref(t.ptr());
Tiago Peixoto's avatar
Tiago Peixoto committed
184
185
186
    }
};

187
188
189
190
191
192
193
194
195
196
197
198
199
template <class T1, class T2>
struct pair_from_tuple
{
    pair_from_tuple()
    {
        converter::registry::push_back(&convertible, &construct,
                                       boost::python::type_id<pair<T1,T2> >());
    }

    static void* convertible(PyObject* obj_ptr)
    {
        handle<> x(borrowed(obj_ptr));
        object o(x);
Tiago Peixoto's avatar
Tiago Peixoto committed
200
        if (boost::python::len(o) < 2)
201
            return 0;
202
203
204
205
206
207
208
209
210
211
212
213
214
        extract<T1> first(o[0]);
        extract<T2> second(o[1]);
        if (!first.check() || !second.check())
            return 0;
        return obj_ptr;
    }

    static void construct(PyObject* obj_ptr,
                          converter::rvalue_from_python_stage1_data* data)
    {
        handle<> x(borrowed(obj_ptr));
        object o(x);
        pair<T1,T2> value;
Tiago Peixoto's avatar
Tiago Peixoto committed
215
        if (boost::python::len(o) < 2)
216
            throw ValueException("Invalid conversion to pair... Sequence is too short.");
217
218
        value.first = extract<T1>(o[0])();
        value.second = extract<T2>(o[1])();
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
        void* storage =
            ( (boost::python::converter::rvalue_from_python_storage
               <pair<T1,T2> >*) data)->storage.bytes;
        new (storage) pair<T1,T2>(value);
        data->convertible = storage;
    }
};

template <class ValueType>
struct variant_from_python
{
    variant_from_python()
    {
        converter::registry::push_back
            (&convertible, &construct,
             boost::python::type_id<GraphInterface::deg_t>());
    }

    static void* convertible(PyObject* obj_ptr)
    {
        handle<> x(borrowed(obj_ptr));
        object o(x);
        extract<ValueType> str(o);
        if (!str.check())
            return 0;
        return obj_ptr;
    }

    static void construct(PyObject* obj_ptr,
                          converter::rvalue_from_python_stage1_data* data)
    {
        handle<> x(borrowed(obj_ptr));
        object o(x);
252
        ValueType value = extract<ValueType>(o)();
253
254
255
256
257
258
259
260
261
        GraphInterface::deg_t deg = value;
        void* storage =
            ( (boost::python::converter::rvalue_from_python_storage
               <GraphInterface::deg_t>*) data)->storage.bytes;
        new (storage) GraphInterface::deg_t(deg);
        data->convertible = storage;
    }
};

Tiago Peixoto's avatar
Tiago Peixoto committed
262
263
// scipy weave integration
#ifdef HAVE_SCIPY
264
template <class ScxxType>
Tiago Peixoto's avatar
Tiago Peixoto committed
265
266
struct scxx_to_python
{
267
    static PyObject* convert(const ScxxType& o)
Tiago Peixoto's avatar
Tiago Peixoto committed
268
269
270
271
272
273
    {
        return incref((PyObject*)(o));
    }
};
#endif

274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
template <class T>
struct integer_from_convertible
{
    integer_from_convertible()
    {
        converter::registry::push_back(&convertible, &construct,
                                       boost::python::type_id<T>());
    }

    static void* convertible(PyObject* obj_ptr)
    {
        if (PyObject_HasAttrString(obj_ptr, "__int__"))
            return obj_ptr;
        return 0;
    }

    static void construct(PyObject* obj_ptr,
                          converter::rvalue_from_python_stage1_data* data)
    {
        handle<> x(borrowed(obj_ptr));
        object o(x);
295
        T value = extract<T>(o.attr("__int__")())();
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
        void* storage =
            ( (boost::python::converter::rvalue_from_python_storage<T>*) data)->storage.bytes;
        new (storage) T(value);
        data->convertible = storage;
    }
};

template <class T>
struct float_from_convertible
{
    float_from_convertible()
    {
        converter::registry::push_back(&convertible, &construct,
                                       boost::python::type_id<T>());
    }

    static void* convertible(PyObject* obj_ptr)
    {
        if (PyObject_HasAttrString(obj_ptr, "__float__"))
            return obj_ptr;
        return 0;
    }

    static void construct(PyObject* obj_ptr,
                          converter::rvalue_from_python_stage1_data* data)
    {
        handle<> x(borrowed(obj_ptr));
        object o(x);
324
        T value = extract<T>(o.attr("__float__")())();
325
326
327
328
329
330
331
332
        void* storage =
            ( (boost::python::converter::rvalue_from_python_storage<T>*) data)->storage.bytes;
        new (storage) T(value);
        data->convertible = storage;
    }
};


333
334
335
336
337
338
339
// persistent python object IO
namespace graph_tool
{
extern python::object object_pickler;
extern python::object object_unpickler;
}

Tiago Peixoto's avatar
Tiago Peixoto committed
340
void set_pickler(boost::python::object o)
341
342
343
344
{
    graph_tool::object_pickler = o;
}

Tiago Peixoto's avatar
Tiago Peixoto committed
345
void set_unpickler(boost::python::object o)
346
347
348
349
{
    graph_tool::object_unpickler = o;
}

Tiago Peixoto's avatar
Tiago Peixoto committed
350
boost::python::list get_property_types()
Tiago Peixoto's avatar
Tiago Peixoto committed
351
{
Tiago Peixoto's avatar
Tiago Peixoto committed
352
353
    boost::python::list plist;
    for (int i = 0; i < boost::mpl::size<value_types>::value; ++i)
Tiago Peixoto's avatar
Tiago Peixoto committed
354
355
356
357
        plist.append(string(type_names[i]));
    return plist;
}

Tiago Peixoto's avatar
Tiago Peixoto committed
358
359
struct graph_type_name
{
Tiago Peixoto's avatar
Tiago Peixoto committed
360
    typedef void result_type;
Tiago Peixoto's avatar
Tiago Peixoto committed
361
    template <class Graph>
362
    void operator()(const Graph& g, string& name) const
Tiago Peixoto's avatar
Tiago Peixoto committed
363
    {
Tiago Peixoto's avatar
Tiago Peixoto committed
364
        using boost::python::detail::gcc_demangle;
Tiago Peixoto's avatar
Tiago Peixoto committed
365
366
367
368
369
370
371
        name = string(gcc_demangle(typeid(Graph).name()));
    }
};

string get_graph_type(GraphInterface& g)
{
    string name;
Tiago Peixoto's avatar
Tiago Peixoto committed
372
373
    run_action<>()(g, std::bind(graph_type_name(), std::placeholders::_1,
                                std::ref(name)))();
Tiago Peixoto's avatar
Tiago Peixoto committed
374
375
376
    return name;
}

377
378
379
380
381
382
383
// numpy array interface weirdness
void* do_import_array()
{
    import_array1(NULL);
    return NULL;
}

384
385
386
387
void ungroup_vector_property(GraphInterface& g, boost::any vector_prop,
                             boost::any prop, size_t pos, bool edge);
void group_vector_property(GraphInterface& g, boost::any vector_prop,
                           boost::any prop, size_t pos, bool edge);
388
void infect_vertex_property(GraphInterface& gi, boost::any prop,
Tiago Peixoto's avatar
Tiago Peixoto committed
389
                            boost::python::object val);
390
391
void edge_endpoint(GraphInterface& gi, boost::any prop,
                   boost::any eprop, std::string endpoint);
392
393
void mark_edges(GraphInterface& gi, boost::any prop);

Tiago Peixoto's avatar
Tiago Peixoto committed
394
395
396
397
398
399
400
void perfect_ehash(GraphInterface& gi, boost::any prop, boost::any hprop,
                   boost::any& dict);

void perfect_vhash(GraphInterface& gi, boost::any prop, boost::any hprop,
                   boost::any& dict);


401
void export_python_interface();
402

403
404
void export_openmp();

405
BOOST_PYTHON_MODULE(libgraph_tool_core)
Tiago Peixoto's avatar
Tiago Peixoto committed
406
{
Tiago Peixoto's avatar
Tiago Peixoto committed
407
408
    using namespace boost::python;

409
    // numpy
410
    do_import_array();
411
    export_python_interface();
Tiago Peixoto's avatar
Tiago Peixoto committed
412

413
414
415
416
    // random numbers
    class_<rng_t>("rng_t");
    def("get_rng", get_rng);

Tiago Peixoto's avatar
Tiago Peixoto committed
417
418
419
420
421
422
    register_exception_translator<GraphException>
        (graph_exception_translator<GraphException>);
    register_exception_translator<IOException>
        (graph_exception_translator<IOException>);
    register_exception_translator<ValueException>
        (graph_exception_translator<ValueException>);
Tiago Peixoto's avatar
Tiago Peixoto committed
423

424
    def("raise_error", &raise_error);
Tiago Peixoto's avatar
Tiago Peixoto committed
425
    def("get_property_types", &get_property_types);
426
427
    class_<boost::any>("any")
        .def("empty", &boost::any::empty);
428

429
    def("graph_filtering_enabled", &graph_filtering_enabled);
430
    export_openmp();
431

Tiago Peixoto's avatar
Tiago Peixoto committed
432
    boost::mpl::for_each<boost::mpl::push_back<scalar_types,string>::type>(export_vector_types());
433
434

    class_<GraphInterface>("GraphInterface", init<>())
Tiago Peixoto's avatar
Tiago Peixoto committed
435
436
        .def(init<GraphInterface,bool,boost::python::object,
                  boost::python::object, boost::python::object>())
437
438
439
440
441
442
        .def("GetNumberOfVertices", &GraphInterface::GetNumberOfVertices)
        .def("GetNumberOfEdges", &GraphInterface::GetNumberOfEdges)
        .def("SetDirected", &GraphInterface::SetDirected)
        .def("GetDirected", &GraphInterface::GetDirected)
        .def("SetReversed", &GraphInterface::SetReversed)
        .def("GetReversed", &GraphInterface::GetReversed)
443
444
        .def("SetKeepEpos", &GraphInterface::SetKeepEpos)
        .def("GetKeepEpos", &GraphInterface::GetKeepEpos)
445
446
447
        .def("SetVertexFilterProperty",
             &GraphInterface::SetVertexFilterProperty)
        .def("IsVertexFilterActive", &GraphInterface::IsVertexFilterActive)
448
        .def("SetEdgeFilterProperty",
449
450
451
452
             &GraphInterface::SetEdgeFilterProperty)
        .def("IsEdgeFilterActive", &GraphInterface::IsEdgeFilterActive)
        .def("PurgeVertices",  &GraphInterface::PurgeVertices)
        .def("PurgeEdges",  &GraphInterface::PurgeEdges)
453
        .def("ShiftVertexProperty",  &GraphInterface::ShiftVertexProperty)
454
        .def("MoveVertexProperty",  &GraphInterface::MoveVertexProperty)
455
        .def("ReIndexVertexProperty",  &GraphInterface::ReIndexVertexProperty)
456
457
        .def("WriteToFile", &GraphInterface::WriteToFile)
        .def("ReadFromFile",&GraphInterface::ReadFromFile)
458
        .def("DegreeMap", &GraphInterface::DegreeMap)
459
        .def("Clear", &GraphInterface::Clear)
460
461
462
        .def("ClearEdges", &GraphInterface::ClearEdges)
        .def("GetVertexIndex", &GraphInterface::GetVertexIndex)
        .def("GetEdgeIndex", &GraphInterface::GetEdgeIndex)
463
        .def("GetMaxEdgeIndex", &GraphInterface::GetMaxEdgeIndex)
464
        .def("ReIndexEdges", &GraphInterface::ReIndexEdges)
465
466
467
        .def("GetGraphIndex", &GraphInterface::GetGraphIndex)
        .def("CopyVertexProperty", &GraphInterface::CopyVertexProperty)
        .def("CopyEdgeProperty", &GraphInterface::CopyEdgeProperty);
468

469
470
471
472
    class_<GraphInterface::vertex_index_map_t>("vertex_index_map", no_init);
    class_<GraphInterface::edge_index_map_t>("edge_index_map", no_init);
    class_<GraphInterface::graph_index_map_t>("graph_index_map", no_init);

473
474
475
476
477
    enum_<GraphInterface::degree_t>("Degree")
        .value("In", GraphInterface::IN_DEGREE)
        .value("Out", GraphInterface::OUT_DEGREE)
        .value("Total", GraphInterface::TOTAL_DEGREE);

478
    variant_from_python<boost::any>();
479
    variant_from_python<GraphInterface::degree_t>();
480
    to_python_converter<pair<string,bool>, pair_to_tuple<string,bool> >();
481
    to_python_converter<pair<size_t,size_t>, pair_to_tuple<size_t,size_t> >();
482
    to_python_converter<pair<double,double>, pair_to_tuple<double,double> >();
483
484
    pair_from_tuple<double,double>();
    pair_from_tuple<size_t,size_t>();
485
486
487
488
489
490
491
492
493
494
495
    integer_from_convertible<uint8_t>();
    integer_from_convertible<int32_t>();
    integer_from_convertible<int64_t>();
    integer_from_convertible<uint32_t>();
    integer_from_convertible<uint64_t>();
    integer_from_convertible<size_t>();
    integer_from_convertible<bool>();
    float_from_convertible<float>();
    float_from_convertible<double>();
    float_from_convertible<long double>();

Tiago Peixoto's avatar
Tiago Peixoto committed
496
#ifdef HAVE_SCIPY
497
498
499
500
501
    to_python_converter<py::object, scxx_to_python<py::object> >();
    to_python_converter<py::tuple, scxx_to_python<py::tuple> >();
    to_python_converter<py::list, scxx_to_python<py::list> >();
    to_python_converter<py::dict, scxx_to_python<py::dict> >();
    to_python_converter<py::str, scxx_to_python<py::str> >();
Tiago Peixoto's avatar
Tiago Peixoto committed
502
#endif
Tiago Peixoto's avatar
Tiago Peixoto committed
503

504
505
506
507
508
509
    class_<IStream>("IStream", no_init).def("Read", &IStream::Read);
    class_<OStream>("OStream", no_init).def("Write", &OStream::Write).
        def("Flush", &OStream::Flush);
    def("set_pickler", &set_pickler);
    def("set_unpickler", &set_unpickler);

510
511
    def("group_vector_property", &group_vector_property);
    def("ungroup_vector_property", &ungroup_vector_property);
512
    def("infect_vertex_property", &infect_vertex_property);
513
    def("edge_endpoint", &edge_endpoint);
514
    def("mark_edges", &mark_edges);
Tiago Peixoto's avatar
Tiago Peixoto committed
515
516
    def("perfect_ehash", &perfect_ehash);
    def("perfect_vhash", &perfect_vhash);
517

Tiago Peixoto's avatar
Tiago Peixoto committed
518
    class_<LibInfo>("mod_info")
519
520
521
        .add_property("name", &LibInfo::GetName)
        .add_property("author", &LibInfo::GetAuthor)
        .add_property("copyright", &LibInfo::GetCopyright)
522
        .add_property("version", &LibInfo::GetVersion)
523
524
525
        .add_property("license", &LibInfo::GetLicense)
        .add_property("cxxflags", &LibInfo::GetCXXFLAGS)
        .add_property("install_prefix", &LibInfo::GetInstallPrefix)
Tiago Peixoto's avatar
Tiago Peixoto committed
526
527
        .add_property("python_dir", &LibInfo::GetPythonDir)
        .add_property("gcc_version", &LibInfo::GetGCCVersion);
Tiago Peixoto's avatar
Tiago Peixoto committed
528
529

    def("get_graph_type", &get_graph_type);
Tiago Peixoto's avatar
Tiago Peixoto committed
530
}