From ac41dabec54bf7426a7b9c77266296ab78b1e200 Mon Sep 17 00:00:00 2001 From: abdalla30r Date: Fri, 11 Jul 2025 21:33:42 +0300 Subject: [PATCH] Added Maximum Independent Set algorithm --- CMakeLists.txt | 2 + GraphOffline.vcxproj | 2 + GraphOffline.vcxproj.filters | 6 ++ Graphoffline.Emscripten.vcxproj | 2 + Graphoffline.Emscripten.vcxproj.filters | 6 ++ algorithm/AlgorithmFactory.cpp | 7 +++ algorithm/MaxIndependentSet.cpp | 75 ++++++++++++++++++++++++ algorithm/MaxIndependentSet.h | 43 ++++++++++++++ graph/Graph.cpp | 52 +++++++++++++++- graph/Graph.h | 2 + graph/IGraph.h | 3 +- test/MaxIndependentSet/_runTests.bat | 28 +++++++++ test/MaxIndependentSet/_runTests.sh | 29 +++++++++ test/MaxIndependentSet/graph1.xml | 15 +++++ test/MaxIndependentSet/graph1.xml.res | 1 + test/MaxIndependentSet/graph10.xml | 11 ++++ test/MaxIndependentSet/graph10.xml.res | 1 + test/MaxIndependentSet/graph11.xml | 10 ++++ test/MaxIndependentSet/graph11.xml.res | 1 + test/MaxIndependentSet/graph12.xml | 15 +++++ test/MaxIndependentSet/graph12.xml.res | 1 + test/MaxIndependentSet/graph13.xml | 21 +++++++ test/MaxIndependentSet/graph13.xml.res | 1 + test/MaxIndependentSet/graph14.xml | 21 +++++++ test/MaxIndependentSet/graph14.xml.res | 1 + test/MaxIndependentSet/graph15.xml | 25 ++++++++ test/MaxIndependentSet/graph15.xml.res | 1 + test/MaxIndependentSet/graph2.xml | 45 ++++++++++++++ test/MaxIndependentSet/graph2.xml.res | 1 + test/MaxIndependentSet/graph3.xml | 17 ++++++ test/MaxIndependentSet/graph3.xml.res | 1 + test/MaxIndependentSet/graph4.xml | 15 +++++ test/MaxIndependentSet/graph4.xml.res | 1 + test/MaxIndependentSet/graph5.xml | 33 +++++++++++ test/MaxIndependentSet/graph5.xml.res | 1 + test/MaxIndependentSet/graph6.xml | 33 +++++++++++ test/MaxIndependentSet/graph6.xml.res | 1 + test/MaxIndependentSet/graph7.xml | 37 ++++++++++++ test/MaxIndependentSet/graph7.xml.res | 1 + test/MaxIndependentSet/graph8.xml | 39 ++++++++++++ test/MaxIndependentSet/graph8.xml.res | 1 + test/MaxIndependentSet/graph9.xml | 30 ++++++++++ test/MaxIndependentSet/graph9.xml.res | 1 + test/MaxIndependentSet/runTests.sh | 10 ++++ test/MaxIndependentSet/testList.txt | 15 +++++ test/MaxIndependentSet/testList_full.txt | 15 +++++ 46 files changed, 677 insertions(+), 2 deletions(-) create mode 100644 algorithm/MaxIndependentSet.cpp create mode 100644 algorithm/MaxIndependentSet.h create mode 100644 test/MaxIndependentSet/_runTests.bat create mode 100755 test/MaxIndependentSet/_runTests.sh create mode 100644 test/MaxIndependentSet/graph1.xml create mode 100644 test/MaxIndependentSet/graph1.xml.res create mode 100644 test/MaxIndependentSet/graph10.xml create mode 100644 test/MaxIndependentSet/graph10.xml.res create mode 100644 test/MaxIndependentSet/graph11.xml create mode 100644 test/MaxIndependentSet/graph11.xml.res create mode 100644 test/MaxIndependentSet/graph12.xml create mode 100644 test/MaxIndependentSet/graph12.xml.res create mode 100644 test/MaxIndependentSet/graph13.xml create mode 100644 test/MaxIndependentSet/graph13.xml.res create mode 100644 test/MaxIndependentSet/graph14.xml create mode 100644 test/MaxIndependentSet/graph14.xml.res create mode 100644 test/MaxIndependentSet/graph15.xml create mode 100644 test/MaxIndependentSet/graph15.xml.res create mode 100644 test/MaxIndependentSet/graph2.xml create mode 100644 test/MaxIndependentSet/graph2.xml.res create mode 100644 test/MaxIndependentSet/graph3.xml create mode 100644 test/MaxIndependentSet/graph3.xml.res create mode 100644 test/MaxIndependentSet/graph4.xml create mode 100644 test/MaxIndependentSet/graph4.xml.res create mode 100644 test/MaxIndependentSet/graph5.xml create mode 100644 test/MaxIndependentSet/graph5.xml.res create mode 100644 test/MaxIndependentSet/graph6.xml create mode 100644 test/MaxIndependentSet/graph6.xml.res create mode 100644 test/MaxIndependentSet/graph7.xml create mode 100644 test/MaxIndependentSet/graph7.xml.res create mode 100644 test/MaxIndependentSet/graph8.xml create mode 100644 test/MaxIndependentSet/graph8.xml.res create mode 100644 test/MaxIndependentSet/graph9.xml create mode 100644 test/MaxIndependentSet/graph9.xml.res create mode 100755 test/MaxIndependentSet/runTests.sh create mode 100644 test/MaxIndependentSet/testList.txt create mode 100644 test/MaxIndependentSet/testList_full.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 05bb983..a2d8b62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,6 +66,8 @@ set(COMMON_LIB_SOURCES algorithm/MaxClique.h algorithm/MaxFlowPushRelabel.h algorithm/MaxFlowPushRelableImpl.h + algorithm/MaxIndependentSet.cpp + algorithm/MaxIndependentSet.h algorithm/PrintAllPaths.cpp algorithm/PrintAllPaths.h algorithm/ShortestPath.h diff --git a/GraphOffline.vcxproj b/GraphOffline.vcxproj index 110628a..634604a 100644 --- a/GraphOffline.vcxproj +++ b/GraphOffline.vcxproj @@ -101,6 +101,7 @@ + @@ -150,6 +151,7 @@ + diff --git a/GraphOffline.vcxproj.filters b/GraphOffline.vcxproj.filters index b6acb03..30864ff 100644 --- a/GraphOffline.vcxproj.filters +++ b/GraphOffline.vcxproj.filters @@ -108,6 +108,9 @@ Source Files\algorithm + + Source Files\algorithm + @@ -218,5 +221,8 @@ Source Files\algorithm + + Source Files\algorithm + \ No newline at end of file diff --git a/Graphoffline.Emscripten.vcxproj b/Graphoffline.Emscripten.vcxproj index 875782e..2141559 100644 --- a/Graphoffline.Emscripten.vcxproj +++ b/Graphoffline.Emscripten.vcxproj @@ -47,6 +47,7 @@ + @@ -74,6 +75,7 @@ + diff --git a/Graphoffline.Emscripten.vcxproj.filters b/Graphoffline.Emscripten.vcxproj.filters index d07bebd..7bb9831 100644 --- a/Graphoffline.Emscripten.vcxproj.filters +++ b/Graphoffline.Emscripten.vcxproj.filters @@ -77,6 +77,9 @@ algorithm + + algorithm + @@ -190,5 +193,8 @@ algorithm + + algorithm + \ No newline at end of file diff --git a/algorithm/AlgorithmFactory.cpp b/algorithm/AlgorithmFactory.cpp index b6353c6..0d88f0d 100644 --- a/algorithm/AlgorithmFactory.cpp +++ b/algorithm/AlgorithmFactory.cpp @@ -19,6 +19,7 @@ #include "PrintAllPaths.h" #include "BellmanFord.h" #include "MaxClique.h" +#include "MaxIndependentSet.h" #include @@ -376,6 +377,12 @@ IAlgorithm* AlgorithmFactory::_CreateAlgorithm(IndexType index, bool bFloat) con break; } + case 12: + { + res = new MaxIndependentSet(); + break; + } + } return res; diff --git a/algorithm/MaxIndependentSet.cpp b/algorithm/MaxIndependentSet.cpp new file mode 100644 index 0000000..4685cb9 --- /dev/null +++ b/algorithm/MaxIndependentSet.cpp @@ -0,0 +1,75 @@ +#include "MaxIndependentSet.h" +#include "IAlgorithmFactory.h" +#include +#include +#include +#include "Logger.h" + +MaxIndependentSet::MaxIndependentSet () { + +} + +MaxIndependentSet::~MaxIndependentSet () { + +} + +bool MaxIndependentSet::Calculate() { + + // this->m_pGraph is not saved in ProcessConsoleParams stack -> no need for delete + + // make a copy of the graph's complement graph + GraphPtr pGraph = GraphPtr(m_pGraph->MakeBaseCopy(GTC_COMPLEMENT)); + if (!pGraph) + { + return false; + } + + LOG_INFO(pGraph->PrintGraph()); + + // run MaxClique algorithm on the complement graph + AlgorithmPtr maxCliqueAlgo = AlgorithmPtr(m_pAlgorithmFactory->CreateAlgorithm("mc", pGraph.get())); + + /** + * By default, MaxClique algorithm will have the following values: + * m_num_threads = 1 + * m_param_lower_bound = 0 + * m_param_upper_bound = UINT_MAX + * m_param_algorithm_type = Exact (Algorithm { Heuristic, Hybrid, Exact }) + */ + + maxCliqueAlgo->Calculate(); + maxCliqueAlgo->UnitTest(); + + IntWeightType resultCount = maxCliqueAlgo->GetResultCount(); + + for (int idx = 1; idx < resultCount; idx++) { + this->m_maxIndependentSet.emplace_back(maxCliqueAlgo->GetResult(idx).nodeId); + } + + return true; +} + + +/** + * Used to loop over the result using GetResult + */ +IndexType MaxIndependentSet::GetResultCount() const { + return this->m_maxIndependentSet.size() + 1; +} + +// Get result of index. Algorithms can have complex result. +/** + * Index 0 will return number of nodes in the MIS found by the algorithm + * Index 1 - will get the corresponding node id. + */ +AlgorithmResult MaxIndependentSet::GetResult(IndexType index) const { + AlgorithmResult res; + if (index == 0) { + res.type = ART_INT; + res.nValue = m_maxIndependentSet.size(); + } else if (index < m_maxIndependentSet.size() + 1 && index > 0) { + res.type = ART_NODE_ID; + res.nodeId = m_maxIndependentSet[index - 1]; + } + return res; +} diff --git a/algorithm/MaxIndependentSet.h b/algorithm/MaxIndependentSet.h new file mode 100644 index 0000000..9f29082 --- /dev/null +++ b/algorithm/MaxIndependentSet.h @@ -0,0 +1,43 @@ +// +// MaxIndependentSet.h +// Graphoffline +// +// Created by Abdalla Egbareia on 16/04/2025 +// +// + +#ifndef Max_Independent_Set_HPP +#define Max_Independent_Set_HPP + +#include +#include "BaseAlgorithm.h" +#include "IGraph.h" +#include + +class MaxIndependentSet : public BaseAlgorithm +{ +public: + MaxIndependentSet (); + virtual ~MaxIndependentSet (); + + // Long name of algoright: MaxIndependentSet. + virtual const char* GetFullName() const override {return "Max Independent Set";}; + // Short name of algorithm: mis + virtual const char* GetShortName() const override {return "mis"; }; + // Calculate algorithm. + virtual bool Calculate() override ; + + // Get result count. + virtual IndexType GetResultCount() const override; + // Get result of index. Algorithms can have complex result. + virtual AlgorithmResult GetResult(IndexType index) const override; + + virtual void UnitTest() const override {} + +private: + + std::vector m_maxIndependentSet; + +}; + +#endif /* Max_Independent_Set_HPP */ diff --git a/graph/Graph.cpp b/graph/Graph.cpp index 4db0e63..3cd0d37 100644 --- a/graph/Graph.cpp +++ b/graph/Graph.cpp @@ -483,6 +483,7 @@ Graph* Graph::MakeGraphCopy(GraphCopyType type, const std::function & case GTC_INVERSE: res = MakeGraphInverse(createFunction); break; case GTC_REMOVE_SELF_LOOP: res = MakeGraphRemoveSelfLoop(createFunction); break; case GTC_REMOVE_NEGATIVE: res = MakeGraphRemoveNegative(createFunction); break; + case GTC_COMPLEMENT: res = MakeGraphComplement(createFunction); break; } if (res) @@ -737,6 +738,55 @@ Graph* Graph::MakeGraphRemoveNegative(const std::function & createFunc } +/** + * It adds all edges ( pairs) that did not occur in the original graph + * Sets all weights to zero + * All edges of the new graph are directed + */ +Graph* Graph::MakeGraphComplement(const std::function & createFunction) const +{ + Graph* res = createFunction ? createFunction() : CreateGraph(); + + CopyPropertiesTo(res); + + res->m_weightType = m_weightType; + + // Create all nodes. + for (NodePtr node : m_nodes) + { + res->m_nodes.push_back(NodePtr(new Node(node->id, node->privateId, node->fake, node->index))); + res->m_idToNode[node->privateId] = res->m_nodes.back(); + } + + // Add all edges that do not exist in the original graph + + for (NodePtr source : res->m_nodes) { + for (NodePtr target : res->m_nodes) { + + // no self loop is permitted + if (source->privateId == target->privateId) continue; + + // if the original graph does not contain the edge - add it to the copy graph + // pass false to IsEgdeExists to handle undirected edges correctly + if (!this->IsEgdeExists(source->privateId, target->privateId, false)) { + auto indexId = res->GetNextId(); + + res->AddEdge(String().FromInt(indexId), + source->privateId, + target->privateId, + true, + 0, + indexId); + } + + } + } + + return res; +} + + + void Graph::RemoveEdge(ObjectId source, ObjectId target) { EdgePtr edge = FindEdge(source, target); @@ -905,7 +955,7 @@ const char* Graph::PrintGraph() const report += "Edges:\n"; for (auto edge : m_edges) { - report += std::string("Public id: ") + edge->id.Locale().Data() + " " + "private id: " + std::to_string(edge->privateId) + "\n"; + report += std::string("Public id: ") + edge->id.Locale().Data() + " " + "private id: " + std::to_string(edge->privateId) + " source: " + edge->source->id.Locale().Data() + " target: " + edge->target->id.Locale().Data() + " directed: " + std::to_string(edge->direct) +"\n"; } return report.c_str(); diff --git a/graph/Graph.h b/graph/Graph.h index e8eeeb7..31e01f9 100644 --- a/graph/Graph.h +++ b/graph/Graph.h @@ -264,6 +264,8 @@ class Graph: public virtual IGraph Graph* MakeGraphRemoveSelfLoop(const std::function & createFunction) const; // Remove negative edges virtual Graph* MakeGraphRemoveNegative(const std::function & createFunction) const; + // Convert current graph to its complement + Graph* MakeGraphComplement(const std::function & createFunction) const; bool IsDouble(double value); diff --git a/graph/IGraph.h b/graph/IGraph.h index 2873925..eff5767 100644 --- a/graph/IGraph.h +++ b/graph/IGraph.h @@ -28,7 +28,8 @@ enum GraphCopyType {GCT_COPY = 0, GTC_REMOVE_SELF_LOOP, GTC_MULTI_TO_COMMON_GRAPH_MINIMAL_EDGES, GTC_MULTI_TO_COMMON_GRAPH_SUM_EDGES, - GTC_REMOVE_NEGATIVE}; + GTC_REMOVE_NEGATIVE, + GTC_COMPLEMENT}; /** * Call back for enum nodes methods (DFS, BSF). diff --git a/test/MaxIndependentSet/_runTests.bat b/test/MaxIndependentSet/_runTests.bat new file mode 100644 index 0000000..7b60606 --- /dev/null +++ b/test/MaxIndependentSet/_runTests.bat @@ -0,0 +1,28 @@ +@echo off + +if "%~1"=="" ( + set exePath="../../bin/Windows/Release/GraphOffline.exe" +) else ( + set exePath="%1" +) + +cd /D "%~dp0" +set COUNTER=0 + +FOR /F "tokens=1-10" %%A IN (testList_full.txt) DO ( + %exePath% -%%A %%B %%C %%D %%E %%F %%G %%H %%I %%J > %%B.test + fc %%B.test %%B.res > nul + if errorlevel 1 @echo %%I\%%B && goto faild + del %%B.test + set /A COUNTER=COUNTER+1 +) + +cd .. + +@echo OK - %COUNTER% tests +exit /B + +:faild +cd .. +@echo "Faild" +exit 1 \ No newline at end of file diff --git a/test/MaxIndependentSet/_runTests.sh b/test/MaxIndependentSet/_runTests.sh new file mode 100755 index 0000000..6e182ed --- /dev/null +++ b/test/MaxIndependentSet/_runTests.sh @@ -0,0 +1,29 @@ +# @echo off + +isFaild=0; + +rm *.test &>/dev/null + +while IFS=$' ' read -r command xmlFile; do + if [ "$2" == "-debug" ]; then + echo "$exePath ${command} ./${xmlFile} > ${xmlFile}.test" + fi + + $exePath ${command} ./${xmlFile} > ${xmlFile}.test + + if diff --ignore-all-space ${xmlFile}.res ${xmlFile}.test >/dev/null ; then + continue; + else + isFaild=1; + echo "${xmlFile} failed." + break; + fi +done < "testList.txt" + +if [ $isFaild -eq 1 ]; then + echo "Failed"; + exit 1; +else + echo "OK" + rm *.test &>/dev/null +fi \ No newline at end of file diff --git a/test/MaxIndependentSet/graph1.xml b/test/MaxIndependentSet/graph1.xml new file mode 100644 index 0000000..346bb76 --- /dev/null +++ b/test/MaxIndependentSet/graph1.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff --git a/test/MaxIndependentSet/graph1.xml.res b/test/MaxIndependentSet/graph1.xml.res new file mode 100644 index 0000000..32a0dc5 --- /dev/null +++ b/test/MaxIndependentSet/graph1.xml.res @@ -0,0 +1 @@ +Result is 3 (n0 n2 n3) \ No newline at end of file diff --git a/test/MaxIndependentSet/graph10.xml b/test/MaxIndependentSet/graph10.xml new file mode 100644 index 0000000..d0ffd0c --- /dev/null +++ b/test/MaxIndependentSet/graph10.xml @@ -0,0 +1,11 @@ + + + + 1 + + + + + + + diff --git a/test/MaxIndependentSet/graph10.xml.res b/test/MaxIndependentSet/graph10.xml.res new file mode 100644 index 0000000..18dfa8e --- /dev/null +++ b/test/MaxIndependentSet/graph10.xml.res @@ -0,0 +1 @@ +Result is 1 (1) \ No newline at end of file diff --git a/test/MaxIndependentSet/graph11.xml b/test/MaxIndependentSet/graph11.xml new file mode 100644 index 0000000..b9e8c99 --- /dev/null +++ b/test/MaxIndependentSet/graph11.xml @@ -0,0 +1,10 @@ + + + + 1 + + + + + + diff --git a/test/MaxIndependentSet/graph11.xml.res b/test/MaxIndependentSet/graph11.xml.res new file mode 100644 index 0000000..3062ed3 --- /dev/null +++ b/test/MaxIndependentSet/graph11.xml.res @@ -0,0 +1 @@ +Result is 0 () \ No newline at end of file diff --git a/test/MaxIndependentSet/graph12.xml b/test/MaxIndependentSet/graph12.xml new file mode 100644 index 0000000..17525de --- /dev/null +++ b/test/MaxIndependentSet/graph12.xml @@ -0,0 +1,15 @@ + + + + 1 + + + + + + + + + + + diff --git a/test/MaxIndependentSet/graph12.xml.res b/test/MaxIndependentSet/graph12.xml.res new file mode 100644 index 0000000..18dfa8e --- /dev/null +++ b/test/MaxIndependentSet/graph12.xml.res @@ -0,0 +1 @@ +Result is 1 (1) \ No newline at end of file diff --git a/test/MaxIndependentSet/graph13.xml b/test/MaxIndependentSet/graph13.xml new file mode 100644 index 0000000..b0055a3 --- /dev/null +++ b/test/MaxIndependentSet/graph13.xml @@ -0,0 +1,21 @@ + + + + 1 + + + + + + + + + + + + + + + + + diff --git a/test/MaxIndependentSet/graph13.xml.res b/test/MaxIndependentSet/graph13.xml.res new file mode 100644 index 0000000..85cc7c5 --- /dev/null +++ b/test/MaxIndependentSet/graph13.xml.res @@ -0,0 +1 @@ +Result is 2 (3 5) \ No newline at end of file diff --git a/test/MaxIndependentSet/graph14.xml b/test/MaxIndependentSet/graph14.xml new file mode 100644 index 0000000..0d07414 --- /dev/null +++ b/test/MaxIndependentSet/graph14.xml @@ -0,0 +1,21 @@ + + + + 1 + + + + + + + + + + + + + + + + + diff --git a/test/MaxIndependentSet/graph14.xml.res b/test/MaxIndependentSet/graph14.xml.res new file mode 100644 index 0000000..85cc7c5 --- /dev/null +++ b/test/MaxIndependentSet/graph14.xml.res @@ -0,0 +1 @@ +Result is 2 (3 5) \ No newline at end of file diff --git a/test/MaxIndependentSet/graph15.xml b/test/MaxIndependentSet/graph15.xml new file mode 100644 index 0000000..83d689d --- /dev/null +++ b/test/MaxIndependentSet/graph15.xml @@ -0,0 +1,25 @@ + + + + 1 + + + + + + + + + + + + + + + + + + + + + diff --git a/test/MaxIndependentSet/graph15.xml.res b/test/MaxIndependentSet/graph15.xml.res new file mode 100644 index 0000000..2dc5ade --- /dev/null +++ b/test/MaxIndependentSet/graph15.xml.res @@ -0,0 +1 @@ +Result is 4 (1 3 5 7) \ No newline at end of file diff --git a/test/MaxIndependentSet/graph2.xml b/test/MaxIndependentSet/graph2.xml new file mode 100644 index 0000000..17b2812 --- /dev/null +++ b/test/MaxIndependentSet/graph2.xml @@ -0,0 +1,45 @@ + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/MaxIndependentSet/graph2.xml.res b/test/MaxIndependentSet/graph2.xml.res new file mode 100644 index 0000000..46a340e --- /dev/null +++ b/test/MaxIndependentSet/graph2.xml.res @@ -0,0 +1 @@ +Result is 6 (0 2 4 7 9 11) \ No newline at end of file diff --git a/test/MaxIndependentSet/graph3.xml b/test/MaxIndependentSet/graph3.xml new file mode 100644 index 0000000..ddc5ffc --- /dev/null +++ b/test/MaxIndependentSet/graph3.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/test/MaxIndependentSet/graph3.xml.res b/test/MaxIndependentSet/graph3.xml.res new file mode 100644 index 0000000..16a3dd9 --- /dev/null +++ b/test/MaxIndependentSet/graph3.xml.res @@ -0,0 +1 @@ +Result is 2 (n0 n2) \ No newline at end of file diff --git a/test/MaxIndependentSet/graph4.xml b/test/MaxIndependentSet/graph4.xml new file mode 100644 index 0000000..0aa2cff --- /dev/null +++ b/test/MaxIndependentSet/graph4.xml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/test/MaxIndependentSet/graph4.xml.res b/test/MaxIndependentSet/graph4.xml.res new file mode 100644 index 0000000..0c46633 --- /dev/null +++ b/test/MaxIndependentSet/graph4.xml.res @@ -0,0 +1 @@ +Result is 3 (n0 n1 n2) \ No newline at end of file diff --git a/test/MaxIndependentSet/graph5.xml b/test/MaxIndependentSet/graph5.xml new file mode 100644 index 0000000..2a82706 --- /dev/null +++ b/test/MaxIndependentSet/graph5.xml @@ -0,0 +1,33 @@ + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/MaxIndependentSet/graph5.xml.res b/test/MaxIndependentSet/graph5.xml.res new file mode 100644 index 0000000..23fdadf --- /dev/null +++ b/test/MaxIndependentSet/graph5.xml.res @@ -0,0 +1 @@ +Result is 9 (1 2 3 5 6 8 9 10 11) \ No newline at end of file diff --git a/test/MaxIndependentSet/graph6.xml b/test/MaxIndependentSet/graph6.xml new file mode 100644 index 0000000..98cd139 --- /dev/null +++ b/test/MaxIndependentSet/graph6.xml @@ -0,0 +1,33 @@ + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/MaxIndependentSet/graph6.xml.res b/test/MaxIndependentSet/graph6.xml.res new file mode 100644 index 0000000..23fdadf --- /dev/null +++ b/test/MaxIndependentSet/graph6.xml.res @@ -0,0 +1 @@ +Result is 9 (1 2 3 5 6 8 9 10 11) \ No newline at end of file diff --git a/test/MaxIndependentSet/graph7.xml b/test/MaxIndependentSet/graph7.xml new file mode 100644 index 0000000..8830ab1 --- /dev/null +++ b/test/MaxIndependentSet/graph7.xml @@ -0,0 +1,37 @@ + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/MaxIndependentSet/graph7.xml.res b/test/MaxIndependentSet/graph7.xml.res new file mode 100644 index 0000000..d0a5026 --- /dev/null +++ b/test/MaxIndependentSet/graph7.xml.res @@ -0,0 +1 @@ +Result is 9 (1 2 3 5 6 8 9 10 11) diff --git a/test/MaxIndependentSet/graph8.xml b/test/MaxIndependentSet/graph8.xml new file mode 100644 index 0000000..c00980c --- /dev/null +++ b/test/MaxIndependentSet/graph8.xml @@ -0,0 +1,39 @@ + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/MaxIndependentSet/graph8.xml.res b/test/MaxIndependentSet/graph8.xml.res new file mode 100644 index 0000000..389a27a --- /dev/null +++ b/test/MaxIndependentSet/graph8.xml.res @@ -0,0 +1 @@ +Result is 8 (1 2 3 6 8 9 10 11) \ No newline at end of file diff --git a/test/MaxIndependentSet/graph9.xml b/test/MaxIndependentSet/graph9.xml new file mode 100644 index 0000000..1ed0a42 --- /dev/null +++ b/test/MaxIndependentSet/graph9.xml @@ -0,0 +1,30 @@ + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/MaxIndependentSet/graph9.xml.res b/test/MaxIndependentSet/graph9.xml.res new file mode 100644 index 0000000..b303785 --- /dev/null +++ b/test/MaxIndependentSet/graph9.xml.res @@ -0,0 +1 @@ +Result is 20 (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20) \ No newline at end of file diff --git a/test/MaxIndependentSet/runTests.sh b/test/MaxIndependentSet/runTests.sh new file mode 100755 index 0000000..edfe82f --- /dev/null +++ b/test/MaxIndependentSet/runTests.sh @@ -0,0 +1,10 @@ +# @echo off + +if [ "$1" == "-linux" ]; then + export exePath=../../bin/Linux/Release/GraphOffline; +else + export exePath=../../bin/Mac/Release/GraphOffline; +fi + +./_runTests.sh $1 $2 + diff --git a/test/MaxIndependentSet/testList.txt b/test/MaxIndependentSet/testList.txt new file mode 100644 index 0000000..eb96060 --- /dev/null +++ b/test/MaxIndependentSet/testList.txt @@ -0,0 +1,15 @@ +-mis graph1.xml +-mis graph2.xml +-mis graph3.xml +-mis graph4.xml +-mis graph5.xml +-mis graph6.xml +-mis graph7.xml +-mis graph8.xml +-mis graph9.xml +-mis graph10.xml +-mis graph11.xml +-mis graph12.xml +-mis graph13.xml +-mis graph14.xml +-mis graph15.xml diff --git a/test/MaxIndependentSet/testList_full.txt b/test/MaxIndependentSet/testList_full.txt new file mode 100644 index 0000000..6690b52 --- /dev/null +++ b/test/MaxIndependentSet/testList_full.txt @@ -0,0 +1,15 @@ +mis graph1.xml +mis graph2.xml +mis graph3.xml +mis graph4.xml +mis graph5.xml +mis graph6.xml +mis graph7.xml +mis graph8.xml +mis graph9.xml +mis graph10.xml +mis graph11.xml +mis graph12.xml +mis graph13.xml +mis graph14.xml +mis graph15.xml