GraphLib
Bearbeitung der Aufgabe Mini Graph Library für OOP WiSe 2023/24
Loading...
Searching...
No Matches
abstract_unweighted_graph.h
Go to the documentation of this file.
1#ifndef GRAPHLIB_INTERNAL_ABSTRACT_UNWEIGHTED_GRAPH_H
2#define GRAPHLIB_INTERNAL_ABSTRACT_UNWEIGHTED_GRAPH_H
3
6#include <ostream>
7
22
23namespace GraphLib::Internal {
24
38template <valid_data_type D, valid_id_type I, valid_edge_type<I> E>
39class UnweightedGraph : public virtual Graph<D, I, E> {
40public:
45 [[nodiscard]] bool is_weighted() const override
46 {
47 return false;
48 }
49
59 void add_edge(const I from_id, const I to_id) override
60 {
61 auto edge = E {};
62 edge.node_id = to_id;
63 this->add_edge_impl(from_id, edge);
64 }
65};
66
67} // namespace GraphLib::Internal
68
69#endif
Defines the generic abstract Graph class template supporting directed/undirected and weighted/unweigh...
Abstract base class for a generic graph structure.
virtual void add_edge_impl(const id_type from_id, const edge_type edge)
Helper to add an edge including reverse edge if undirected.
A graph class representing unweighted graphs.
bool is_weighted() const override
Indicates that this graph is unweighted.
void add_edge(const I from_id, const I to_id) override
Adds an unweighted edge from one node to another.
Defines C++20 concepts used for type constraints in the GraphLib library.