LCOV - code coverage report
Current view: top level - app/src/Alg - Graph.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 16 22 72.7 %
Date: 2023-08-17 16:45:52 Functions: 5 6 83.3 %

          Line data    Source code
       1             : #include "Alg/Graph.hpp"
       2             : 
       3             : using namespace std;
       4             : using namespace Alg;
       5             : 
       6             : const Graph::Edge::Weight Graph::Edge::WEIGHT_INF = 1.0e15;
       7             : 
       8             : const Graph::Edge Graph::EDGE_INVALID = {-1, NODE_INVALID, NODE_INVALID, 0};
       9             : 
      10      608366 : void Graph::addNode(Node u) {
      11      608366 :     adj[u];
      12      608366 : }
      13             : 
      14     1652150 : void Graph::addEdge(Edge::ID id, Node u, Node v, Edge::Weight c) {
      15     1652150 :     adj[u].push_back({id, u, v, c});
      16     1652150 :     adj[v];
      17     1652150 : }
      18             : 
      19      302115 : vector<Graph::Node> Graph::getNodes() const {
      20      302115 :     vector<Graph::Node> ret;
      21     2284830 :     for(const auto &[u, _]: adj)
      22     1982720 :         ret.push_back(u);
      23             : 
      24      302115 :     return ret;
      25             : }
      26             : 
      27     2102100 : vector<Graph::Edge> &Graph::getAdj(Node u) {
      28     2102100 :     return adj.at(u);
      29             : }
      30             : 
      31     1485290 : const vector<Graph::Edge> &Graph::getAdj(Node u) const {
      32     1485290 :     return adj.at(u);
      33             : }
      34             : 
      35           0 : Graph Graph::transpose() const {
      36           0 :     Graph ret;
      37             : 
      38           0 :     for(const auto &[u, adj_u]: adj)
      39           0 :         for(const auto &e: adj_u)
      40           0 :             ret.addEdge(e.id, e.v, e.u, e.w);
      41             : 
      42           0 :     return ret;
      43             : }

Generated by: LCOV version 1.14