We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0dfe43c commit e6a429eCopy full SHA for e6a429e
src/core/InfomapBase.h
@@ -151,7 +151,11 @@ class InfomapBase : public InfomapConfig<InfomapBase> {
151
152
double getOneLevelCodelength() const { return m_oneLevelCodelength; }
153
154
- double getRelativeCodelengthSavings() const { return 1.0 - codelength() / getOneLevelCodelength(); }
+ double getRelativeCodelengthSavings() const
155
+ {
156
+ auto oneLevelCodelength = getOneLevelCodelength();
157
+ return oneLevelCodelength < 1e-16 ? 0 : 1.0 - codelength() / oneLevelCodelength;
158
+ }
159
160
bool isFullNetwork() const { return m_isMain && m_aggregationLevel == 0; }
161
bool isFirstLoop() { return m_tuneIterationIndex == 0 && isFullNetwork(); }
0 commit comments