[Networkit] Interface conventions for analytics algorithms

Henning Meyerhenke meyerhenke at kit.edu
Thu Oct 30 15:59:50 CET 2014

>> At quite a few places we have some preprocessing
>> in the ctor. Then we need the flexibility in the run method to invoke it
>> for different query parameters. Such a separation of preprocessing/query
>> must be possible and efficient.
> - Henning
> Yes, but as Michael explained, this can just as well be done by not using the constructor as a run method and not using the run method as a getter. Long computations should not happen unexpectedly, and a long running constructor is unexpected. Here’s the convention I propose:
> - constructor: parameter setting, cheap
> - run-method: computation, expensive
> - getters: queries, cheap
> There might be good reasons to deviate from that, so I would not enforce it with a superclass. But mostly it is done for no better reason than „it’s the first thing that came to my mind“. Right now I can’t think of a case where it doesn’t fit - anyone? (@Michael: Even a stopping criterion could just as well be an optional constructor argument.)

This separation is okay with me. All I was trying to say that we need 
the separation with flexible query (and possibly also preprocessing) 
arguments. I didn't want to insist on an expensive ctor. The name "run" 
for what I would call preprocessing in the AD case, for example, is not 
in every case intuitive. Probably this led to a misunderstanding. But 
for consistency you can go with "run" if you like.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5316 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://lists.ira.uni-karlsruhe.de/mailman/private/networkit/attachments/20141030/980ed363/attachment.p7s>

More information about the NetworKit mailing list