[Networkit] Code Quality
michael.hamann at kit.edu
Mon Aug 18 16:45:13 CEST 2014
Am Sonntag, 17. August 2014, 10:55:43 schrieb Marvin Ritter:
> *1) Be more careful with changes to core classes (e.g. Graph, readers, ...)*
> Example: Someone changed the parameter of Graph.BFSfrom (the handle gets
> now 2 parameters).
Concerning the example: I've added a backwards compatibility/convenience
wrapper similar to what we have for the new edge iterators in the edgeids
branch which allows the handles to accept either one or two parameters. I
hadn't added that back then as I didn't know about the possibility.
> *2) Write test good test cases*
> I just fixed a method in Graph and removed another one because it was wrong
> and never used.
> Everybody makes mistakes, but if you write good test cases or ask someone
> to review changes, it is more likely that we notice them before a release.
Concerning the test cases, imho good test cases should also include test cases
with graphs with some deleted nodes and edges. As I'm filtering some of the
graphs that I analyze, I've experienced crashes even in algorithms like PLM.
Using "upperNodeIdBound" and paying special attention to "none" values in
partitions is really important (partitions don't know about the fact that
nodes have been deleted). I've just noticed that ParallelConnectedComponents
simply ignored the fact that nodes might be deleted and treated them as
isolated nodes (I've fixed that now).
> *3) Fix compiler warnings*
> I know most of the compiler warnings from gcc can be ignored, but I would
> prefer fixing them anyway. It is not a big deal and it makes it easier to
> find important ones.
More information about the NetworKit