Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions kagen/generators/hyperbolic/hyperbolic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ void Hyperbolic<Double>::Query(
right_processed_cell_ = cell_id;

// Iterate over cell
if (search_down /* || !IsLocalChunk(chunk_id) */) // second condition should be always true?
if (search_down || !IsLocalChunk(chunk_id))
GenerateGridEdges(annulus_id, chunk_id, cell_id, q);

bool found_nonlocal_chunk = false;
Expand All @@ -467,7 +467,7 @@ void Hyperbolic<Double>::Query(
// std::cout << "go right " << next_chunk_id << " " << annulus_id << " " << next_cell_id << std::endl;
GenerateVertices(annulus_id, next_chunk_id, next_cell_id);
found_nonlocal_chunk |= QueryRightNeighbor(
annulus_id, next_chunk_id, next_cell_id, q, std::abs(min_cell_phi - 0.0) < cell_eps_);
annulus_id, next_chunk_id, next_cell_id, q, std::abs(min_cell_phi - 0.0) < cell_eps_, search_down);
}

// Continue left
Expand Down Expand Up @@ -513,7 +513,7 @@ void Hyperbolic<Double>::Query(

template <typename Double>
bool Hyperbolic<Double>::QueryRightNeighbor(
const SInt annulus_id, SInt chunk_id, SInt cell_id, const Vertex& q, bool phase) {
const SInt annulus_id, SInt chunk_id, SInt cell_id, const Vertex& q, bool phase, bool search_down) {
/*bool out = false;
if (std::get<5>(q) == 1280) {
std::cout << "\tQueryRightNeighbor(" << annulus_id << ", " << chunk_id << ", " << cell_id << ", "
Expand Down Expand Up @@ -549,10 +549,10 @@ bool Hyperbolic<Double>::QueryRightNeighbor(
<< std::endl;
}*/

// if ((false && search_down && IsLocalChunk(chunk_id) && min_cell_phi > std::get<0>(q)) ||
// !IsLocalChunk(chunk_id))
if (!IsLocalChunk(chunk_id)) {
found_nonlocal_chunk = true;
if (search_down || !IsLocalChunk(chunk_id)) {
if (!IsLocalChunk(chunk_id)) {
found_nonlocal_chunk = true;
}
GenerateGridEdges(annulus_id, chunk_id, cell_id, q);
}

Expand Down
2 changes: 1 addition & 1 deletion kagen/generators/hyperbolic/hyperbolic.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class Hyperbolic : public virtual Generator, private EdgeListOnlyGenerator {

void Query(SInt annulus_id, SInt chunk_id, SInt cell_id, const Vertex& q, bool search_down = true);

bool QueryRightNeighbor(SInt annulus_id, SInt chunk_id, SInt cell_id, const Vertex& q, bool phase);
bool QueryRightNeighbor(SInt annulus_id, SInt chunk_id, SInt cell_id, const Vertex& q, bool phase, bool search_down);

bool QueryLeftNeighbor(SInt annulus_id, SInt chunk_id, SInt cell_id, const Vertex& q, bool phase, bool search_down);

Expand Down
206 changes: 203 additions & 3 deletions tests/geometric/hyperbolic_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ void validate_graph(const Graph& local_graph, const PGeneratorConfig& config) {
}
}

void test_configuration(const SInt n, const double avg_degree, const double plexp) {
void test_configuration(const SInt n, const double avg_degree, const double plexp, const int seed = 1) {
PGeneratorConfig config;
config.n = n;
config.avg_degree = avg_degree;
config.plexp = plexp;
config.seed = seed;
config.hp_floats = true;
config.coordinates = true;

Expand All @@ -53,10 +54,209 @@ void test_configuration(const SInt n, const double avg_degree, const double plex
}
} // namespace

TEST(Geometric2DTest, generates_graph_on_np_PE_n16_d4_g3) {
// All tests use n >= 8 to avoid MPI buffer aliasing in gather infrastructure.
// Parameters: n, avg_degree, plexp (gamma)

// === Original tests ===

TEST(HyperbolicTest, n16_d4_g3) {
test_configuration(16, 4.0, 3.0);
}

TEST(Geometric2DTest, generates_graph_on_np_PE_n512_d4_g3) {
TEST(HyperbolicTest, n512_d4_g3) {
test_configuration(512, 4.0, 3.0);
}

// === Known problematic case (vertex_range inconsistencies) ===

TEST(HyperbolicTest, n1024_d16_g3) {
test_configuration(1024, 16.0, 3.0);
}

// === Small graphs ===

TEST(HyperbolicTest, n8_d2_g3) {
test_configuration(8, 2.0, 3.0);
}

TEST(HyperbolicTest, n8_d4_g3) {
test_configuration(8, 4.0, 3.0);
}

TEST(HyperbolicTest, n16_d2_g3) {
test_configuration(16, 2.0, 3.0);
}

TEST(HyperbolicTest, n32_d4_g3) {
test_configuration(32, 4.0, 3.0);
}

// === Varying avg_degree ===

TEST(HyperbolicTest, n64_d2_g3) {
// Low average degree (sparse)
test_configuration(64, 2.0, 3.0);
}

TEST(HyperbolicTest, n64_d4_g3) {
test_configuration(64, 4.0, 3.0);
}

TEST(HyperbolicTest, n64_d8_g3) {
// Higher average degree
test_configuration(64, 8.0, 3.0);
}

TEST(HyperbolicTest, n128_d4_g3) {
test_configuration(128, 4.0, 3.0);
}

TEST(HyperbolicTest, n128_d8_g3) {
test_configuration(128, 8.0, 3.0);
}

TEST(HyperbolicTest, n128_d16_g3) {
// High average degree
test_configuration(128, 16.0, 3.0);
}

TEST(HyperbolicTest, n256_d4_g3) {
test_configuration(256, 4.0, 3.0);
}

TEST(HyperbolicTest, n256_d16_g3) {
test_configuration(256, 16.0, 3.0);
}

// === Varying plexp (gamma / power law exponent) ===

TEST(HyperbolicTest, n64_d4_g22) {
// Low gamma: flatter degree distribution, more hub nodes
test_configuration(64, 4.0, 2.2);
}

TEST(HyperbolicTest, n64_d4_g25) {
test_configuration(64, 4.0, 2.5);
}

TEST(HyperbolicTest, n64_d4_g35) {
// Higher gamma: steeper power law, fewer hubs
test_configuration(64, 4.0, 3.5);
}

TEST(HyperbolicTest, n64_d4_g5) {
// Very high gamma: very steep power law
test_configuration(64, 4.0, 5.0);
}

TEST(HyperbolicTest, n128_d4_g22) {
test_configuration(128, 4.0, 2.2);
}

TEST(HyperbolicTest, n128_d4_g25) {
test_configuration(128, 4.0, 2.5);
}

TEST(HyperbolicTest, n256_d4_g25) {
test_configuration(256, 4.0, 2.5);
}

TEST(HyperbolicTest, n256_d4_g5) {
test_configuration(256, 4.0, 5.0);
}

// === Combined: varying both avg_degree and plexp ===

TEST(HyperbolicTest, n64_d2_g25) {
// Sparse + low gamma
test_configuration(64, 2.0, 2.5);
}

TEST(HyperbolicTest, n64_d8_g25) {
// Dense + low gamma
test_configuration(64, 8.0, 2.5);
}

TEST(HyperbolicTest, n64_d2_g5) {
// Sparse + high gamma
test_configuration(64, 2.0, 5.0);
}

TEST(HyperbolicTest, n64_d8_g5) {
// Dense + high gamma
test_configuration(64, 8.0, 5.0);
}

// === Larger graphs ===

TEST(HyperbolicTest, n1000_d4_g3) {
test_configuration(1000, 4.0, 3.0);
}

TEST(HyperbolicTest, n1000_d8_g25) {
test_configuration(1000, 8.0, 2.5);
}

TEST(HyperbolicTest, n2000_d4_g3) {
test_configuration(2000, 4.0, 3.0);
}

TEST(HyperbolicTest, n2000_d8_g3) {
test_configuration(2000, 8.0, 3.0);
}

TEST(HyperbolicTest, n2000_d16_g3) {
test_configuration(2000, 16.0, 3.0);
}

TEST(HyperbolicTest, n3000_d4_g25) {
test_configuration(3000, 4.0, 2.5);
}

// === Different seeds ===

TEST(HyperbolicTest, n64_d4_g3_seed42) {
test_configuration(64, 4.0, 3.0, 42);
}

TEST(HyperbolicTest, n64_d4_g3_seed123) {
test_configuration(64, 4.0, 3.0, 123);
}

TEST(HyperbolicTest, n256_d4_g3_seed7) {
test_configuration(256, 4.0, 3.0, 7);
}

TEST(HyperbolicTest, n256_d8_g25_seed999) {
test_configuration(256, 8.0, 2.5, 999);
}

// === Non-power-of-two node counts ===

TEST(HyperbolicTest, n9_d4_g3) {
test_configuration(9, 4.0, 3.0);
}

TEST(HyperbolicTest, n13_d4_g3) {
test_configuration(13, 4.0, 3.0);
}

TEST(HyperbolicTest, n50_d4_g3) {
test_configuration(50, 4.0, 3.0);
}

TEST(HyperbolicTest, n99_d4_g3) {
test_configuration(99, 4.0, 3.0);
}

TEST(HyperbolicTest, n127_d4_g3) {
test_configuration(127, 4.0, 3.0);
}

TEST(HyperbolicTest, n500_d4_g3) {
test_configuration(500, 4.0, 3.0);
}

TEST(HyperbolicTest, n1500_d8_g3) {
test_configuration(1500, 8.0, 3.0);
}
Loading
Loading