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

Christian Staudt christian.staudt at kit.edu
Wed Jul 30 13:46:40 CEST 2014


Hi NetworKit developers,

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. Usage is roughly like this:

	std::vector<double> edgeAttribute(G.upperEdgeIdBound());
	G.parallelForEdges([&](node u, node v, edgeid eid){
		edgeAttribute[eid] += 1.0;
	});

To keep the Graph object lean, edges can be indexed when needed after construction of the object. From then on, addEdge automatically assigns new ids to new edges.

- The old hacky API for edge attributes (for which the graph itself stored attributes of primitive types) will be removed. The few algorithms that used it (EdmondsKarp, ModularityScoring, ParallelMatcher) will be broken until adapted to the new system. We ask the respective authors to update their code or tell us if the classes can be removed.
- By the use of template magic, we performed a cleanup of the graph iterator methods. E.g. the forEdges method can now handle functions with different signatures, like (node, node), (node, node, edgeweight), (node, node, edgeid), (node, node, edgeweight, edgeid)…. A separate method forWeightedEdges is no longer required, much less new methods like forWeightedAndIndexedEdges… 

This new code is in the branch „edgeids". Review and comments are welcome before we merge it into the main branch.

Best regards
Chris

christian.staudt at kit.edu
http://parco.iti.kit.edu/staudt/index-en.shtml
Institute of Theoretical Informatics - Parallel Computing Group 
Building 50.34 Room 034
Karlsruhe Institute of Technology (KIT)








-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ira.uni-karlsruhe.de/mailman/private/networkit/attachments/20140730/97f21cba/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.ira.uni-karlsruhe.de/mailman/private/networkit/attachments/20140730/97f21cba/attachment.sig>


More information about the NetworKit mailing list