diff --git a/.gitignore b/.gitignore index 017fc93..ac796da 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,7 @@ x86/ *.vcxproj *.vcxproj.user -*.vcxproj.filters \ No newline at end of file +*.vcxproj.filters + +*.pdf +*.pptx \ No newline at end of file diff --git a/decremental-maintenance-scc/README.md b/decremental-maintenance-scc/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/decremental-maintenance-tc/README.md b/decremental-maintenance-tc/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/docs/IMPROVED DYNAMIC REACHABILITY ALGORITHMS.pdf b/docs/IMPROVED DYNAMIC REACHABILITY ALGORITHMS.pdf deleted file mode 100644 index 797cbdd..0000000 Binary files a/docs/IMPROVED DYNAMIC REACHABILITY ALGORITHMS.pdf and /dev/null differ diff --git a/dynamic-reachability-algorithms.sln b/dynamic-reachability-algorithms.sln index 5e8fb60..8e8197b 100644 --- a/dynamic-reachability-algorithms.sln +++ b/dynamic-reachability-algorithms.sln @@ -1,11 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.32407.337 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32421.90 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "decremental-maintenance-scc", "decremental-maintenance-scc\decremental-maintenance-scc.vcxproj", "{15B26719-56E0-412A-9CDB-B74D7B23E1BA}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "decremental-maintenance-tc", "decremental-maintenance-tc\decremental-maintenance-tc.vcxproj", "{B26C07ED-1749-4C40-A9F2-F9486B133F2F}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dynamic-reachability-algorithms", "dynamic-reachability-algorithms.vcxproj", "{1CB6022E-575B-4DA3-9AB6-0EE7090A56C8}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,27 +13,19 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {15B26719-56E0-412A-9CDB-B74D7B23E1BA}.Debug|x64.ActiveCfg = Debug|x64 - {15B26719-56E0-412A-9CDB-B74D7B23E1BA}.Debug|x64.Build.0 = Debug|x64 - {15B26719-56E0-412A-9CDB-B74D7B23E1BA}.Debug|x86.ActiveCfg = Debug|Win32 - {15B26719-56E0-412A-9CDB-B74D7B23E1BA}.Debug|x86.Build.0 = Debug|Win32 - {15B26719-56E0-412A-9CDB-B74D7B23E1BA}.Release|x64.ActiveCfg = Release|x64 - {15B26719-56E0-412A-9CDB-B74D7B23E1BA}.Release|x64.Build.0 = Release|x64 - {15B26719-56E0-412A-9CDB-B74D7B23E1BA}.Release|x86.ActiveCfg = Release|Win32 - {15B26719-56E0-412A-9CDB-B74D7B23E1BA}.Release|x86.Build.0 = Release|Win32 - {B26C07ED-1749-4C40-A9F2-F9486B133F2F}.Debug|x64.ActiveCfg = Debug|x64 - {B26C07ED-1749-4C40-A9F2-F9486B133F2F}.Debug|x64.Build.0 = Debug|x64 - {B26C07ED-1749-4C40-A9F2-F9486B133F2F}.Debug|x86.ActiveCfg = Debug|Win32 - {B26C07ED-1749-4C40-A9F2-F9486B133F2F}.Debug|x86.Build.0 = Debug|Win32 - {B26C07ED-1749-4C40-A9F2-F9486B133F2F}.Release|x64.ActiveCfg = Release|x64 - {B26C07ED-1749-4C40-A9F2-F9486B133F2F}.Release|x64.Build.0 = Release|x64 - {B26C07ED-1749-4C40-A9F2-F9486B133F2F}.Release|x86.ActiveCfg = Release|Win32 - {B26C07ED-1749-4C40-A9F2-F9486B133F2F}.Release|x86.Build.0 = Release|Win32 + {1CB6022E-575B-4DA3-9AB6-0EE7090A56C8}.Debug|x64.ActiveCfg = Debug|x64 + {1CB6022E-575B-4DA3-9AB6-0EE7090A56C8}.Debug|x64.Build.0 = Debug|x64 + {1CB6022E-575B-4DA3-9AB6-0EE7090A56C8}.Debug|x86.ActiveCfg = Debug|Win32 + {1CB6022E-575B-4DA3-9AB6-0EE7090A56C8}.Debug|x86.Build.0 = Debug|Win32 + {1CB6022E-575B-4DA3-9AB6-0EE7090A56C8}.Release|x64.ActiveCfg = Release|x64 + {1CB6022E-575B-4DA3-9AB6-0EE7090A56C8}.Release|x64.Build.0 = Release|x64 + {1CB6022E-575B-4DA3-9AB6-0EE7090A56C8}.Release|x86.ActiveCfg = Release|Win32 + {1CB6022E-575B-4DA3-9AB6-0EE7090A56C8}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {5ED86738-305B-4CD2-87F5-86F3C18A1DBB} + SolutionGuid = {940035A3-C111-4769-BB27-9285F4CDDA52} EndGlobalSection EndGlobal diff --git a/include/graph.h b/include/graph.h new file mode 100644 index 0000000..a90bd60 --- /dev/null +++ b/include/graph.h @@ -0,0 +1,61 @@ +#ifndef GRAPH_H_ +#define GRAPH_H_ + +#include +#include +#include +#include + +namespace graph { + +template +class Graph { +public: + Graph() = default; + + // Add vertex v + void insert(const V& v); + + // Add edge between v and u + void insert(const V& v, const V& u); + + // Delete vertex v + void erase(const V& v); + + // Delete edge between v and u + void erase(const V& v, const V& u); + + // Return true if v and u are connected + bool connected(const V& v, const V& u); +private: + std::map> adjacency; +}; + +template +inline void Graph::insert(const V& v) { + adjacency[v]; +} + +template +inline void Graph::insert(const V& v, const V& u) { + adjacency[v].insert(u); +} + +template +inline void Graph::erase(const V& v) { + adjacency.erase(v); +} + +template +inline void Graph::erase(const V& v, const V& u) { + adjacency[v].erase(u); +} + +template +inline bool Graph::connected(const V& v, const V& u) { + return true; +} + +} // namespace graph + +#endif \ No newline at end of file diff --git a/test/graph_test.cc b/test/graph_test.cc new file mode 100644 index 0000000..7ec5bb4 --- /dev/null +++ b/test/graph_test.cc @@ -0,0 +1,26 @@ +#include + +#include + +#include "include/graph.h" + +TEST_SUITE("Testing Graph.") { + using namespace graph; + + TEST_CASE("Insert vertices/edges.") { + Graph G; + + G.insert(1, 2); + G.insert(1, 4); + G.insert(1, 6); + G.insert(2, 4); + G.insert(2, 5); + G.insert(3, 4); + G.insert(3, 6); + G.insert(4, 6); + G.insert(5, 6); + + // CHECK_EQ(G.connected(1, 5), true); + + } +} \ No newline at end of file diff --git a/test/main.cc b/test/main.cc new file mode 100644 index 0000000..bb266f3 --- /dev/null +++ b/test/main.cc @@ -0,0 +1,2 @@ +#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN +#include \ No newline at end of file