Skip to content

refactor: drop Boost.Algorithm - #590

Merged
Becheler merged 1 commit into
boostorg:developfrom
Becheler:refactor/drop-boost-algorithm
Sep 6, 2026
Merged

refactor: drop Boost.Algorithm#590
Becheler merged 1 commit into
boostorg:developfrom
Becheler:refactor/drop-boost-algorithm

Conversation

@Becheler

@Becheler Becheler commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

Before submitting

  • This PR targets the develop branch.
  • I searched for an existing PR or issue covering the same change.
  • My contribution is licensed under the Boost Software License 1.0.

Type of change

  • Bug fix
  • New feature or API addition
  • Refactor (no behavior change)
  • Documentation
  • Build, CI, or tooling
  • Other (specify below)

Does this PR introduce a breaking change?

  • Yes (describe migration impact below)
  • No

What this PR does

  • topology.hpp: replaced algorithm/minmax.hpp include with <algorithm>
  • howard_cycle_ratio.hpp and bc_clustering.hpp: replaced boost::first_max_element with an explicit first-max loop
  • graphviz.hpp: replaced boost::algorithm::replace_all with a quote-escape loop
  • read_graphviz_new.cpp: replaced boost::algorithm::to_lower_copy with std::transform
  • parallel_edges_loops_test.cpp and all_planar_input_files_test.cpp: replaced boost::split with a loop
  • Added test/bc_clustering_test.cpp: guards the max-edge pick (bridge removed, graph splits into 2 components)

std::max_element is not usable here: it requires a ForwardIterator, and libc++ enforces that with a hard static_assert, but BGL's edge iterators declare a category that does not satisfy it. boost::first_max_element had no such check, so the replacement is a short explicit loop instead.

Motivation

Boost.Algorithm adds 30 dependencies for something that STL and short loops can do easily.

Testing

Checklist

  • Existing tests pass (b2 in the test/ directory).
  • New behavior is covered by a test, or this is a docs / build / refactor change.
  • Documentation was updated if user-facing behavior changed.
  • No new compiler warnings on the platforms I built against.

@Becheler Becheler self-assigned this Sep 6, 2026
@Becheler Becheler added the dependencies Pull requests that update a dependency file label Sep 6, 2026
@Becheler Becheler changed the title refactor: replace boost algorithms with standard refactor: replace Boost.Algorithm with standard alternatives Sep 6, 2026
@Becheler
Becheler force-pushed the refactor/drop-boost-algorithm branch from 037a616 to b40801d Compare September 6, 2026 10:34
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Boost dependency footprint vs develop (auto-generated).
PR run 34031987491 vs develop run 33983571785 (ca7d38dc74).

Header-inclusion weights (graph files pulling each direct dependency in):

Dependency develop PR Δ
algorithm 5 0 -5

Transitive Boost modules: 49 → 47 (-2)

  • removed: algorithm, exception

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Compiler-warning counts vs develop (auto-generated).
PR run 34031987477 vs develop run 33983571789 (ca7d38dc74).

Job Baseline After Delta
macos (clang, 14) 439 444 +5
macos (clang, 17) 402 407 +5
macos (clang, 20) 402 407 +5
ubuntu (clang-19, 14) 439 444 +5
ubuntu (clang-19, 17) 402 407 +5
ubuntu (clang-19, 20) 402 407 +5
ubuntu (clang-19, 23) 402 407 +5
ubuntu (gcc-14, 14) 373 373 0
ubuntu (gcc-14, 17) 369 369 0
ubuntu (gcc-14, 20) 369 369 0
ubuntu (gcc-14, 23) 369 369 0
windows_msvc_14_3 (msvc-14.3) 961 961 0

@Becheler
Becheler force-pushed the refactor/drop-boost-algorithm branch 2 times, most recently from 269f9c8 to f873e39 Compare September 6, 2026 12:00
@Becheler
Becheler force-pushed the refactor/drop-boost-algorithm branch from f873e39 to ca7d38d Compare September 6, 2026 12:03
@codecov

codecov Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Becheler Becheler changed the title refactor: replace Boost.Algorithm with standard alternatives refactor: drop Boost.Algorithm Sep 6, 2026
@Becheler
Becheler merged commit 3f8a9ce into boostorg:develop Sep 6, 2026
32 checks passed
Comment on lines -135 to +138
edge_descriptor e
= *boost::first_max_element(edges_iters.first, edges_iters.second, cmp);
auto max_edge_it = edges_iters.first;
for (auto edge_it = edges_iters.first; edge_it != edges_iters.second; ++edge_it)
if (cmp(*max_edge_it, *edge_it))
max_edge_it = edge_it;
edge_descriptor e = *max_edge_it;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

std::max_element - cppreference.com https://share.google/cBYeq3gW04DAipAiH
?

@Becheler Becheler Sep 6, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

That was my first try but it fails compilation because of a conflict between requirements of boost versus stl iterators (ForwardIterator).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Passing to std would be going back to the problem described in #175 and #190

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ehhh, I see, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants