Skip to content

Fix circle layout docs and cleanup#469

Open
andreacassioli wants to merge 6 commits into
boostorg:developfrom
andreacassioli:fix-circle-layout-docs-and-cleanup
Open

Fix circle layout docs and cleanup#469
andreacassioli wants to merge 6 commits into
boostorg:developfrom
andreacassioli:fix-circle-layout-docs-and-cleanup

Conversation

@andreacassioli
Copy link
Copy Markdown
Contributor

@andreacassioli andreacassioli commented Apr 11, 2026

Fix synopsis in the circle_layout docs (currently broken)

Incidentally I looked at the source code of that function and decided to do some small tweaking of the source code to add a const, use auto and remove a typedef.

@andreacassioli
Copy link
Copy Markdown
Contributor Author

any feedback on this tiny fix @jeremy-murphy

@Becheler Becheler self-assigned this May 21, 2026
@Becheler Becheler added the docs label May 21, 2026
Comment thread include/boost/graph/circle_layout.hpp Outdated

vertices_size_type i = 0;
double two_pi_over_n = 2. * pi / n;
auto i = 0;
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.

I believe auto i = 0 is a slight regression on type-correctness. It deduces int, where the original code used the graph's vertices_size_type On graphs with more than INT_MAX vertices this would overflow ?

With vertices_size_type, ++i cannot overflow because i only reaches n - 1, and n came from num_vertices(g) that returns vertices_size_type. By construction, i stays within the representable range of its type.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

reverted to the vertices_size_type

Copy link
Copy Markdown
Collaborator

@Becheler Becheler left a comment

Choose a reason for hiding this comment

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

Let's see what @jeremy-murphy thinks but I would be ok merging this PR if the type-correctness issue is confirmed and fixed ? Maybe that would warrant a comment ?

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants