Skip to content
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ if(PIXIE_BENCHMARKS)
benchmark
benchmark_main
${PIXIE_DIAGNOSTICS_LIBS})
if(PIXIE_THIRD_PARTY_BACKENDS)
target_include_directories(dfuds_tree_benchmarks
PRIVATE ${sdsl_lite_SOURCE_DIR}/include)
endif()

add_executable(alignment_comparison
src/benchmarks/alignment_comparison.cpp)
Expand Down
11 changes: 2 additions & 9 deletions include/pixie/dfuds_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ namespace pixie {
* @brief A tree class based on the depth-first unary degree sequence (DFUDS)
* representation
*/
template <typename RMMTree>
class DFUDSTree {
private:
const size_t num_bits_;
RmMTree rmm_;
RMMTree rmm_;

public:
struct Node {
Expand Down Expand Up @@ -152,12 +153,4 @@ std::vector<uint64_t> adj_to_dfuds(
return dfuds;
}

bool operator==(const AdjListNode& a, const DFUDSTree::Node& b) {
return a.number == b.number;
}

bool operator==(const DFUDSTree::Node& b, const AdjListNode& a) {
return a.number == b.number;
}

} // namespace pixie
12 changes: 10 additions & 2 deletions src/benchmarks/dfuds_tree_benchmarks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@

#include <random>

using Node = pixie::DFUDSTree::Node;
#ifdef SDSL_SUPPORT
#pragma message("SDSL_SUPPORT enabled")
#include "pixie/rmm_tree_sdsl.h"
using DFUDSTree = pixie::DFUDSTree<pixie::SdslRmMTree>;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid using the incomplete SDSL backend for DFUDS

When the third-party benchmark preset defines SDSL_SUPPORT, this alias instantiates DFUDSTree with SdslRmMTree. DFUDS traversal calls select0 in degree, first_child, and parent, but SdslRmMTree::select0_impl is currently a stub returning npos; for any non-leaf random tree, first_child(root) wraps npos + 1 back to 0 and the DFS loop walks invalid nodes instead of measuring the tree. Keep this benchmark on RmMTree or implement select0 in the SDSL adapter before selecting it here.

Useful? React with 👍 / 👎.

#else
#pragma message("SDSL_SUPPORT disabled")
using DFUDSTree = pixie::DFUDSTree<pixie::RmMTree>;
#endif

using Node = DFUDSTree::Node;
using pixie::adj_to_dfuds;
using pixie::DFUDSTree;

/**
* DFS with O(1) extra memory
Expand Down
12 changes: 10 additions & 2 deletions src/tests/dfuds_tree_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,17 @@
#include <random>
#include <stack>

using Node = pixie::DFUDSTree::Node;
using DFUDSTree = pixie::DFUDSTree<pixie::RmMTree>;
using Node = DFUDSTree::Node;
using pixie::adj_to_dfuds;
using pixie::DFUDSTree;

bool operator==(const AdjListNode& a, const DFUDSTree::Node& b) {
return a.number == b.number;
}

bool operator==(const DFUDSTree::Node& b, const AdjListNode& a) {
return a.number == b.number;
}

TEST(DfudsTreeTest, Basic) {
std::vector<std::vector<size_t>> adj = {{0, 1}, {0, 2}, {1, 3}, {2, 4}, {3}};
Expand Down
Loading