Skip to content

Commit

Permalink
Add test case of large edgeless graph to compare performance of InDeg…
Browse files Browse the repository at this point in the history
…ree and OutDegree functions
  • Loading branch information
scpeters committed Sep 6, 2017
1 parent 15d976c commit a4edbb1
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/graph/Graph_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -393,3 +393,42 @@ TYPED_TEST(GraphTestFixture, EdgeFromId)
EXPECT_EQ(kNullId, e.Id());
}
}

/////////////////////////////////////////////////
TYPED_TEST(GraphTestFixture, EdgelessInDegree)
{
TypeParam graph;

// add a bunch of vertices but no edges
const int vertexCount = 10000;
for (int i = 0; i < vertexCount; ++i)
{
auto &v = graph.AddVertex(std::to_string(i), i);
EXPECT_TRUE(v.Valid());
}

for (auto idVertex : graph.Vertices())
{
EXPECT_EQ(0, graph.InDegree(idVertex.first));
}
}

/////////////////////////////////////////////////
TYPED_TEST(GraphTestFixture, EdgelessOutDegree)
{
TypeParam graph;

// add a bunch of vertices but no edges
const int vertexCount = 10000;
for (int i = 0; i < vertexCount; ++i)
{
auto &v = graph.AddVertex(std::to_string(i), i);
EXPECT_TRUE(v.Valid());
}


for (auto idVertex : graph.Vertices())
{
EXPECT_EQ(0, graph.OutDegree(idVertex.first));
}
}

0 comments on commit a4edbb1

Please sign in to comment.