[Networkit] request for comments: edge ids and attributes

Florian Weber uagws at student.kit.edu
Tue Jun 10 20:05:39 CEST 2014

On 10.06.2014 17:03, Marvin Ritter wrote:
> Do you ever want to use GraphWithEdgeAttributes in Python or should it only be 
> used by in algorithms in C++?

I have to admit that I didn't think that much about Cythons problems
with mapping inheritance, but it might actually work out quite well to
not expose the inheritance to it (the python class currently only holds
a pointer to a C++-graph; I am quite positive that it wouldn't be that
much work to say that this is a pointer to either the base or an
inheriting class.

Concerning the templates: We have a more general problem there: If we
want to enable Attributes that are more flexible than just strings, we
have to be able to safe arbitrary python-objects in C++; My guess (I
know little about Python close to nothing about Cython) is that there is
some way to do this via something like std::unique_ptr<python_object>.
If this is the case we could easily follow the approach that I lined out
and just use that special-case for python (Leaving the more powerful
Interface for C++-users only; I don't think this would be a problem
since the python users can safe all of their types, while the
implementation at the C++ side is almost exactly the same).



class Graph:
	# may point to C++-Graph or
	# C++-GraphWithEdgeAttributes<PythonObject*>:
	_Graph* g

	# other stuff

C++: see my last mail

-------------- n?chster Teil --------------
Ein Dateianhang mit Bin?rdaten wurde abgetrennt...
Dateiname   : signature.asc
Dateityp    : application/pgp-signature
Dateigr??e  : 901 bytes
Beschreibung: OpenPGP digital signature
URL         : <https://lists.ira.uni-karlsruhe.de/mailman/private/networkit/attachments/20140610/2325e6a1/attachment.sig>

More information about the NetworKit mailing list