#ifndef C___WEIGHTEDGRAPH_H #define C___WEIGHTEDGRAPH_H #include #include #include struct Node { // todo: introduce neighbor struct and use it instead of std::pair std::list> neighbours; Node() = default; explicit Node(std::list> neighbours); void add_edge(int node_id, double weight); [[nodiscard]] int deg() const; }; class WeightedGraph { public: explicit WeightedGraph(size_t num_nodes); void add_edge(int from, int to, double weight); [[nodiscard]] std::list> adjList(int node_id) const; [[nodiscard]] size_t num_nodes() const; [[nodiscard]] int num_edges() const; [[nodiscard]] int deg(int v) const; [[nodiscard]] std::pair min_neighbour(int node_id) const; [[nodiscard]] WeightedGraph remove_parallel() const; private: std::vector nodes; int edges; }; #endif //C___WEIGHTEDGRAPH_H