• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

networkit / networkit / 19529302360

20 Nov 2025 07:38AM UTC coverage: 79.387% (+0.2%) from 79.235%
19529302360

push

github

web-flow
Merge pull request #1360 from Schwarf/coverage/edge_scores

Add unit tests for class EdgeScoreAsWeight.

13 of 16 new or added lines in 2 files covered. (81.25%)

29424 of 37064 relevant lines covered (79.39%)

2282490.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/networkit/cpp/edgescores/EdgeScoreAsWeight.cpp
1
/*
2
 * EdgeScoreAsWeight.cpp
3
 *
4
 *  Created on: 18.11.2014
5
 *      Author: Michael Hamann
6
 */
7

8
#include "networkit/edgescores/EdgeScore.hpp"
9
#include <networkit/edgescores/EdgeScoreAsWeight.hpp>
10

11
namespace NetworKit {
12

13
EdgeScoreAsWeight::EdgeScoreAsWeight(const Graph &G, const std::vector<double> &score, bool squared,
×
14
                                     edgeweight offset, edgeweight factor)
×
15
    : G(&G), score(&score), squared(squared), offset(offset), factor(factor) {}
×
16

17
Graph EdgeScoreAsWeight::calculate() {
×
NEW
18
    WARN("The class EdgeScoreAsWeight is deprecated and will be removed in future releases."
×
19
         "Use EdgeScore<T>::calculate(...) instead.");
20
    if (!G->hasEdgeIds()) {
×
NEW
21
        throw std::runtime_error("Edges have not been indexed - call indexEdges first");
×
22
    }
23

24
    Graph result(*G, true, false);
×
25

26
    if (squared) {
×
27
        G->parallelForEdges([&](node u, node v, edgeid eid) {
×
28
            result.setWeight(u, v, offset + factor * (*score)[eid] * (*score)[eid]);
×
29
        });
×
30
    } else {
31
        G->parallelForEdges([&](node u, node v, edgeid eid) {
×
32
            result.setWeight(u, v, offset + factor * (*score)[eid]);
×
33
        });
×
34
    }
35

36
    return result;
×
37
}
×
38

39
} // namespace NetworKit
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc