Files
reachability-algorithms/graph/graph.h
2022-05-07 17:05:43 +03:00

58 lines
938 B
C++

#ifndef GRAPH_H_
#define GRAPH_H_
#include <map>
#include <set>
#include <utility>
#include <vector>
#include <iostream>
namespace graph {
template<typename T>
class Graph {
public:
Graph() = default;
// Add vertex v
void insert(const T& v);
// Add edge between v and u
void insert(const T& v, const T& u);
// Delete vertex v
void erase(T& v);
// Delete edge between v and u
void erase(T& v, T& u);
// Adjacency matrix representation
std::set<T> vertices;
std::map<T, std::vector<T>> adjMatrix;
};
template<typename T>
inline void Graph<T>::insert(const T& v) {
vertices.insert(v);
}
template<typename T>
inline void Graph<T>::insert(const T& v, const T& u) {
vertices.insert(v);
vertices.insert(u);
adjMatrix[v].push_back(u);
}
template<typename T>
inline void Graph<T>::erase(T& v) {
//
}
template<typename T>
inline void Graph<T>::erase(T& v, T& u) {
//
}
} // namespace graph
#endif