Skip to content

Commit

Permalink
wrote graph initializing test
Browse files Browse the repository at this point in the history
  • Loading branch information
GregorySchwing committed Aug 13, 2021
1 parent 1cf00ab commit dd48ead
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 2 additions & 0 deletions simpleParallel/COO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
4 changes: 2 additions & 2 deletions simpleParallel/Graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,15 +376,15 @@ void Graph::CountingSortParallelRowwiseValues(
void Graph::RemoveNewlyDegreeZeroVertices(std::vector<int> & verticesToRemove,
std::vector<int> & oldRowOffsets,
std::vector<int> & oldColumnIndices){

int i = 0, j;
for (auto & v :verticesToRemove){
removeVertex(v);
for (i = oldRowOffsets[v]; i < oldRowOffsets[v+1]; ++i){
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);
}
}
}
Expand Down
13 changes: 7 additions & 6 deletions test/src/GraphTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
TEST(GraphTest, GraphTest) {
COO cycle;
cycle.BuildCycleCOO();
cycle.SetVertexCountFromEdges();
CSR csr(cycle);
Graph g(csr);
std::vector<int> oddVertices;
std::vector<int> 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);
}

0 comments on commit dd48ead

Please sign in to comment.