generate-shapes/src/util/graph/Graph.h

56 lines
1.6 KiB
C
Raw Normal View History

2018-06-09 17:14:08 +02:00
// Copyright 2016, University of Freiburg,
// Chair of Algorithms and Data Structures.
// Authors: Patrick Brosi <brosi@informatik.uni-freiburg.de>
#ifndef UTIL_GRAPH_GRAPH_H_
#define UTIL_GRAPH_GRAPH_H_
2022-03-28 14:59:55 +02:00
#include <cassert>
#include <iostream>
2018-06-09 17:14:08 +02:00
#include <set>
#include <string>
#include "util/graph/Edge.h"
#include "util/graph/Node.h"
namespace util {
namespace graph {
template <typename N, typename E>
class Graph {
public:
2023-10-06 12:13:25 +02:00
Graph() {} ;
Graph(const Graph& g) = delete;
Graph(Graph& g) = delete;
void operator=(const Graph& other) = delete;
void operator=(Graph& other) = delete;
2018-07-13 18:04:27 +02:00
virtual ~Graph();
2018-06-09 17:14:08 +02:00
virtual Node<N, E>* addNd() = 0;
virtual Node<N, E>* addNd(const N& pl) = 0;
Edge<N, E>* addEdg(Node<N, E>* from, Node<N, E>* to);
virtual Edge<N, E>* addEdg(Node<N, E>* from, Node<N, E>* to, const E& p) = 0;
2023-10-06 12:13:25 +02:00
virtual Edge<N, E>* addEdg(Node<N, E>* from, Node<N, E>* to, E&& p) = 0;
2018-06-09 17:14:08 +02:00
Edge<N, E>* getEdg(Node<N, E>* from, Node<N, E>* to);
2022-03-28 14:59:55 +02:00
const Edge<N, E>* getEdg(const Node<N, E>* from, const Node<N, E>* to) const;
2018-06-09 17:14:08 +02:00
virtual Node<N, E>* mergeNds(Node<N, E>* a, Node<N, E>* b) = 0;
const std::set<Node<N, E>*>& getNds() const;
static Node<N, E>* sharedNode(const Edge<N, E>* a, const Edge<N, E>* b);
2018-06-09 17:14:08 +02:00
typename std::set<Node<N, E>*>::iterator delNd(Node<N, E>* n);
typename std::set<Node<N, E>*>::iterator delNd(
typename std::set<Node<N, E>*>::iterator i);
void delEdg(Node<N, E>* from, Node<N, E>* to);
protected:
2022-03-28 14:59:55 +02:00
std::set<Node<N, E>*> _nodes;
2018-06-09 17:14:08 +02:00
};
#include "util/graph/Graph.tpp"
2022-03-28 14:59:55 +02:00
} // namespace graph
} // namespace util
2018-06-09 17:14:08 +02:00
#endif // UTIL_GRAPH_GRAPH_H_