[Networkit] request for comments: new API for edge attributes

Florian Weber uagws at student.kit.edu
Wed Jul 30 23:15:48 CEST 2014


Hi,

> Gerd, Michael an I have implemented a concept for supporting 
> *arbitrary edge attributes*. The idea is that edges receive*integer 
> ids* just as nodes do. This allows the storage of arbitrary objects 
> associated with an edge in a list, vector, or any integer-indexed 
> container. Storage is therefore no longer handled by the graph data 
> structure itself.

I haven't looked to deep into this (I have an exam tomorrow, I'll have
more time after that), but my first thought was: Why aren't you just
using a std::pair<index, index> as id-type? That way you could just save
the attributes in a std::hash_map<EdgeId, std::unique_ptr<AttributeBase>>?

Concerning the new code: You are using the long form of enable_if which
gets very ugly, very fast. Among other things I would recommend to use
the AUX_REQUIRE-macro¹ in StringBuilder.h that allows you to both
describe what you require and removes much boilerplate:

template<typename T,
         AUX_REQUIRE(SomeDescription, std::is_integral<T>::value)>
void some_method_that_only_works_with_integral_arguments(T arg) { ... }

Currently all of this stuff is in StringBuilder.h since this was the
only place so far that (according to my knowledge) used
template-metaprogramming. Since this is no longer the case, I will
probably move these things to their own header (TMP.h? Templates.h?
something like that).

That's it for now, I'll take a closer look at it before Monday.

Regards,
Florian

[1] Yeah, macros are very evil, but not being able to read the code is
even worse.


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


More information about the NetworKit mailing list