Commit c7ab73fa authored by Tiago de Paula Peixoto's avatar Tiago de Paula Peixoto

Merge commit 'tags/release-1.1.1' into release-1.1

parents 3ea05358 081cc91a
dnl Process this file with autoconf to produce a configure script.
AC_INIT(graph-tool, 1.1.0)
AC_INIT(graph-tool, 1.1.1)
AC_CONFIG_SRCDIR(src/graph-tool)
AM_INIT_AUTOMAKE
AM_PROG_CC_C_O
......@@ -190,10 +190,10 @@ AC_DEFINE_UNQUOTED([PACKAGE_DATA_DIR], "${packageprefix}/${packagedatadir}", [pa
AC_DEFINE_UNQUOTED([PACKAGE_DOC_DIR], "${packageprefix}/${packagedocdir}", [package doc dir])
AC_DEFINE_UNQUOTED([PACKAGE_SOURCE_DIR], "${packagesrcdir}", [package source dir])
AC_DEFINE_UNQUOTED([AUTHOR], "Tiago de Paula Peixoto <tpeixoto@if.usp.br>", [program author(s)])
AC_DEFINE_UNQUOTED([AUTHOR], "Tiago de Paula Peixoto <tiago@forked.de>", [program author(s)])
AC_DEFINE_UNQUOTED([COPYRIGHT],
"Copyright (C) 2006 Tiago de Paula Peixoto\nThis is free software; see the source for copying conditions. There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.",
"Copyright (C) 2007 Tiago de Paula Peixoto\nThis is free software; see the source for copying conditions. There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.",
[copyright info])
AC_DEFINE([SVN_REVISION], "esyscmd(svnversion -n .)", [svn revision number])
......
......@@ -34,8 +34,8 @@ using namespace boost;
using namespace boost::lambda;
using namespace graph_tool;
typedef mpl::vector<bool, int, long, float, double, std::string> value_types;
char* type_names[] = {"boolean", "int", "long", "float", "double", "string"};
typedef mpl::vector<bool, int, long, size_t, float, double, std::string> value_types;
char* type_names[] = {"boolean", "int", "long", "long", "float", "double", "string"};
//==============================================================================
......@@ -167,8 +167,9 @@ struct edit_property
for (tie(ei, e_end) = edges(g); ei != e_end; ++ei)
{
e = *ei;
Descriptor& ec = e;
python::object val = operation();
prop_map.put(*ei, val);
prop_map.put(ec, val);
}
}
......
......@@ -162,6 +162,7 @@ public:
_python_class.def("out_edges", python::range(&PythonVertex::OutEdgesBegin, &PythonVertex::OutEdgesEnd));
_python_class.def("in_edges", python::range(&PythonVertex::InEdgesBegin, &PythonVertex::InEdgesEnd));
_python_class.def(python::self == python::self);
_python_class.def(python::self != python::self);
_python_class.def("__hash__", &PythonVertex::GetHash);
first_time = false;
}
......@@ -354,11 +355,16 @@ public:
return python::object(get<1>(base) == get<1>(o_base));
}
else
{
{
return false;
}
}
bool operator!=(const PythonVertex& other)
{
return !(*this == other);
}
python::class_<PythonVertex> GetPythonClass() { return _python_class; }
private:
......@@ -385,8 +391,10 @@ public:
_python_class.def("source", &PythonEdge::GetSource);
_python_class.def("target", &PythonEdge::GetTarget);
_python_class.def("get_property", &PythonEdge::GetProperty);
_python_class.def("put_property", &PythonEdge::PutProperty);
_python_class.def("n_parallel", &PythonEdge::GetNParallel);
_python_class.def(python::self == python::self);
_python_class.def(python::self != python::self);
_python_class.def("__hash__", &PythonEdge::GetHash);
first_time = false;
}
......@@ -464,7 +472,7 @@ public:
for(typeof(dp.begin()) iter = dp.lower_bound(prop); iter != dp.end(); ++iter)
{
if (iter->second->key() != typeid(vertex_descriptor) && iter->second->key() != typeid(graph_property_tag))
return get_python_property_value<edge_descriptor>(*iter->second, e)();
return do_get_property(*iter->second, e, typename is_convertible<typename graph_traits<Graph>::directed_category, undirected_tag>::type());
}
return python::object();
}
......@@ -474,7 +482,19 @@ public:
}
}
void PutProperty(std::string prop, python::object val)
python::object do_get_property(const dynamic_property_map& dmap, const edge_descriptor& e, false_type)
{
return get_python_property_value<edge_descriptor>(dmap, e)();
}
python::object do_get_property(const dynamic_property_map& dmap, const edge_descriptor& e, true_type)
{
typedef typename edge_descriptor::original_edge_t original_edge_t;
return get_python_property_value<original_edge_t>(dmap, original_edge_t(e))();
}
void PutProperty(const std::string& prop, const python::object& val)
{
if (_base != python::object())
{
......@@ -484,11 +504,23 @@ public:
for(typeof(dp.begin()) iter = dp.lower_bound(prop); iter != dp.end(); ++iter)
{
if (iter->second->key() != typeid(vertex_descriptor) && iter->second->key() != typeid(graph_property_tag))
put_python_property_value<vertex_descriptor>(*iter->second, e, val)();
do_put_property(*iter->second, e, val, typename is_convertible<typename graph_traits<Graph>::directed_category, undirected_tag>::type());
}
}
}
void do_put_property(dynamic_property_map& dmap, const edge_descriptor& e, python::object val, false_type)
{
put_python_property_value<edge_descriptor>(dmap, e, val)();
}
void do_put_property(dynamic_property_map& dmap, const edge_descriptor& e, python::object val, true_type)
{
typedef typename edge_descriptor::original_edge_t original_edge_t;
const original_edge_t& oe = e;
put_python_property_value<original_edge_t>(dmap, oe, val)();
}
python::object GetNParallel()
{
if (_base != python::object())
......@@ -544,6 +576,11 @@ public:
}
}
bool operator!=(const PythonEdge& other)
{
return !(*this == other);
}
python::class_<PythonEdge> GetPythonClass() { return _python_class; }
private:
......
Markdown is supported
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