From 7eee5a78005a9a569186d2c8b4b645a818ab9bf1 Mon Sep 17 00:00:00 2001 From: Stoycho Kyosev Date: Sun, 6 Oct 2024 07:04:44 -0400 Subject: Cleanup --- Seminar11/Graph-Impl/MatrixGraph/MatrixGraph.h | 52 -------------------------- 1 file changed, 52 deletions(-) delete mode 100644 Seminar11/Graph-Impl/MatrixGraph/MatrixGraph.h (limited to 'Seminar11/Graph-Impl/MatrixGraph/MatrixGraph.h') diff --git a/Seminar11/Graph-Impl/MatrixGraph/MatrixGraph.h b/Seminar11/Graph-Impl/MatrixGraph/MatrixGraph.h deleted file mode 100644 index aade1a1..0000000 --- a/Seminar11/Graph-Impl/MatrixGraph/MatrixGraph.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -Ориентиран тегловен граф представен чрез матрица на съседство. - -Плюсове: -* Лесна имплементация -* Проверка за ребро, премахване на ребро, добавяне на ребро са O(1) - -Минуси: -* Паметта винаги е O(|V|^2) -* Намирането на предшественици (наследници) или в неориентирания случай на съседи отнема O(|V|) време. - -weight_t => тип, чрез който представяме тежест -vertex_t => тип, чрез който представяме връх -*/ - -#ifndef GRAPH_IMPL_H -#define GRAPH_IMPL_H - -#include -#include - -class MatrixGraph { - public: - using vertex_t = unsigned int; - using weight_t = unsigned int; - - private: - std::vector> data; - - public: - MatrixGraph(size_t); - - void addVertex(); - void removeVertex(vertex_t); - - void addDirectedEdge(vertex_t from, vertex_t to, weight_t w); - void addEdge(vertex_t from, vertex_t to, weight_t w); - void removeEdge(vertex_t from, vertex_t to); - - bool validVertex(vertex_t) const; - weight_t getWeight(vertex_t, vertex_t) const; - - size_t vertexCount() const; - bool adjacent(vertex_t from, vertex_t to) const; - - std::vector getSuccessors(vertex_t) const; - std::vector getPredecessors(vertex_t) const; - // Same as getSuccessors, here for interface purposes. - std::vector adjacent(vertex_t) const; -}; - -#endif \ No newline at end of file -- cgit v1.3.1-26-gb76a