65 lines
1.1 KiB
C++
65 lines
1.1 KiB
C++
#ifndef GRAPH_H_
|
|
#define GRAPH_H_
|
|
|
|
#include "vertex.h"
|
|
|
|
#include <map>
|
|
#include <set>
|
|
#include <vector>
|
|
#include <utility>
|
|
|
|
namespace graph {
|
|
|
|
template<typename T>
|
|
class Graph {
|
|
public:
|
|
Graph() = default;
|
|
|
|
// Add vertex v
|
|
void insert(Vertex<T>& v);
|
|
|
|
// Add edge between v and u
|
|
void insert(Vertex<T> v, Vertex<T> u);
|
|
|
|
// Delete vertex v
|
|
void erase(Vertex<T>& v);
|
|
|
|
// Delete edge between v and u
|
|
void erase(Vertex<T>& v, Vertex<T>& u);
|
|
|
|
// Return true if v and u are connected
|
|
bool connected(const Vertex<T>& v, const Vertex<T>& u) const;
|
|
|
|
// Adjacency matrix representation
|
|
std::vector<Vertex<T>> vertices;
|
|
};
|
|
|
|
template<typename T>
|
|
inline void Graph<T>::insert(Vertex<T>& v) {
|
|
vertices.push_back(v);
|
|
}
|
|
|
|
template<typename T>
|
|
inline void Graph<T>::insert(Vertex<T> v, Vertex<T> u) {
|
|
v.edges.push_back(u);
|
|
vertices.push_back(v);
|
|
}
|
|
|
|
template<typename T>
|
|
inline void Graph<T>::erase(Vertex<T>& v) {
|
|
//
|
|
}
|
|
|
|
template<typename T>
|
|
inline void Graph<T>::erase(Vertex<T>& v, Vertex<T>& u) {
|
|
//
|
|
}
|
|
|
|
template<typename T>
|
|
inline bool Graph<T>::connected(const Vertex<T>& v, const Vertex<T>& u) const {
|
|
return false;
|
|
}
|
|
|
|
} // namespace graph
|
|
|
|
#endif |