diff --git a/MainSimpleParallel.cpp b/MainSimpleParallel.cpp index 7e113e9..fd64695 100644 --- a/MainSimpleParallel.cpp +++ b/MainSimpleParallel.cpp @@ -25,7 +25,7 @@ int main(int argc, char *argv[]) //Graph g("small.csv"); COO coordinateFormat; // std::string filename = "small.csv"; - std::string filename = "25.csv"; + std::string filename = "25_nodes.csv"; coordinateFormat.BuildCOOFromFile(filename); //coordinateFormat.BuildTheExampleCOO(); @@ -39,7 +39,7 @@ int main(int argc, char *argv[]) } CSR csr(coordinateFormat); Graph g(csr); - int k = 25; + int k = 9; //int k = 4; ParallelKernelization sk(g, k); sk.TestAValueOfK(k); @@ -78,6 +78,17 @@ int main(int argc, char *argv[]) std::cout << v << " "; std::cout << std::endl; } + + COO coordinateFormatTest; +// std::string filename = "small.csv"; + //std::string filename = "25_nodes.csv"; + coordinateFormatTest.BuildCOOFromFile(filename); + coordinateFormatTest.SetVertexCountFromEdges(); + CSR csrTest(coordinateFormatTest); + Graph gTest(csrTest); + gTest.InitG(gTest, answer); + std::cout << "Edges remaining in original graph after removing answer : " << gTest.GetEdgesLeftToCover() << std::endl; + gTest.PrintEdgesRemaining(); /* diff --git a/simpleParallel/Graph.cpp b/simpleParallel/Graph.cpp index c13fb19..c596f5e 100644 --- a/simpleParallel/Graph.cpp +++ b/simpleParallel/Graph.cpp @@ -437,6 +437,19 @@ void Graph::PrintEdgesOfS(){ std::cout << "}" << std::endl; } +void Graph::PrintEdgesRemaining(){ + std::cout << "E(G') = {"; + int i, u, v; + for (u = 0; u < vertexCount; ++u){ + for (i = (*(csr.old_row_offsets_ref))[u]; i < (*(csr.old_row_offsets_ref))[u+1]; ++i){ + v = (*(csr.old_column_indices_ref))[i]; + if(csr.new_values[i]) + std::cout << "(" << u << ", " << v << "), "; + } + } + std::cout << "}" << std::endl; +} + bool Graph::GPrimeEdgesGreaterKTimesKPrime(int k, int kPrime){ int kTimesKPrime = k * kPrime; if (edgesLeftToCover/2 > kTimesKPrime) diff --git a/simpleParallel/Graph.h b/simpleParallel/Graph.h index c5b7d73..9eda96e 100644 --- a/simpleParallel/Graph.h +++ b/simpleParallel/Graph.h @@ -48,6 +48,7 @@ class Graph { void InduceSubgraph(); int GetVertexCount(); void PrintEdgesOfS(); + void PrintEdgesRemaining(); bool GPrimeEdgesGreaterKTimesKPrime(int k, int kPrime); std::vector< std::vector > & GetChildrenVertices(); void SetVerticesToIncludeInCover(std::vector & verticesRef);