diff --git a/simpleParallel/COO.cpp b/simpleParallel/COO.cpp index e3a6275..a344fd9 100644 --- a/simpleParallel/COO.cpp +++ b/simpleParallel/COO.cpp @@ -96,6 +96,8 @@ void COO::BuildCycleCOO(){ for (auto & edge : orderedMap) addEdge(edge.first.first, edge.first.second, edge.second); + for (auto & edge : orderedMap) + std::cout << "(" << edge.first.first << ", " << edge.first.second << ")" << std::endl; size = new_values.size(); } diff --git a/simpleParallel/Graph.cpp b/simpleParallel/Graph.cpp index 7fb3ad9..603ec44 100644 --- a/simpleParallel/Graph.cpp +++ b/simpleParallel/Graph.cpp @@ -376,7 +376,6 @@ void Graph::CountingSortParallelRowwiseValues( void Graph::RemoveNewlyDegreeZeroVertices(std::vector & verticesToRemove, std::vector & oldRowOffsets, std::vector & oldColumnIndices){ - int i = 0, j; for (auto & v :verticesToRemove){ removeVertex(v); @@ -384,7 +383,8 @@ void Graph::RemoveNewlyDegreeZeroVertices(std::vector & verticesToRemove, j = oldColumnIndices[i]; if(new_degrees[j] == 0) if (hasntBeenRemoved[j]){ - removeVertex(j); + std::cout << "removing newly degree zero vertex" << j << std::endl; + removeVertex(j); } } } diff --git a/test/src/GraphTest.cpp b/test/src/GraphTest.cpp index 0157b55..8b8c578 100644 --- a/test/src/GraphTest.cpp +++ b/test/src/GraphTest.cpp @@ -3,15 +3,16 @@ TEST(GraphTest, GraphTest) { COO cycle; cycle.BuildCycleCOO(); + cycle.SetVertexCountFromEdges(); CSR csr(cycle); Graph g(csr); - std::vector oddVertices; + std::vector evenVertices; for(int i = 0; i < g.GetVertexCount(); ++i) - if(i%2==1) - oddVertices.push_back(i); + if(i % 2 == 0){ + evenVertices.push_back(i); + } - g.InitG(g, oddVertices); + g.InitG(g, evenVertices); int remainingEdges = g.GetEdgesLeftToCover(); - std::cout << remainingEdges << std::endl; - EXPECT_EQ(remainingEdges, -1); + EXPECT_EQ(remainingEdges, 0); }