Skip to content

Fix doctests that depend on Set/Dict iteration order#493

Merged
Krastanov merged 1 commit intoJuliaGraphs:masterfrom
Krastanov-agent:fix-doctests-julia-pre
Feb 23, 2026
Merged

Fix doctests that depend on Set/Dict iteration order#493
Krastanov merged 1 commit intoJuliaGraphs:masterfrom
Krastanov-agent:fix-doctests-julia-pre

Conversation

@Krastanov-agent
Copy link
Copy Markdown
Contributor

Julia 1.13 changes the iteration order of Set and Dict, causing 4 doctest failures. The algorithms produce correct results; only the output order differs.

Changes:

  • clique_percolation doctest: wrap in sort(..., by=first) to normalize BitSet ordering
  • cycle_basis doctest: wrap in sort(sort.(...)) to normalize cycle element and list ordering
  • maximal_independent_sets doctest: wrap in sort(sort.(...)) to normalize set element and list ordering
  • maximum_independent_set doctest: check length(...) instead of specific elements, since multiple valid maximum independent sets exist (e.g. [2,5,7] and [2,4,6] are both valid for cycle_graph(7))

Tests pass on both Julia 1.12 (Pkg.test()) and Julia 1.13-beta2 (full test suite excluding JET, which is not yet compatible with 1.13).

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 21, 2026

Benchmark Results (Julia v1)

Time benchmarks
master a564fd1... master / a564fd1...
centrality/digraphs/betweenness_centrality 16 ± 0.83 ms 16.3 ± 0.71 ms 0.981 ± 0.066
centrality/digraphs/closeness_centrality 11.4 ± 0.41 ms 11.7 ± 0.74 ms 0.974 ± 0.071
centrality/digraphs/degree_centrality 1.93 ± 0.14 μs 1.9 ± 0.13 μs 1.02 ± 0.1
centrality/digraphs/katz_centrality 0.845 ± 0.06 ms 0.844 ± 0.056 ms 1 ± 0.097
centrality/digraphs/pagerank 0.0367 ± 0.00079 ms 0.0368 ± 0.00058 ms 0.996 ± 0.027
centrality/graphs/betweenness_centrality 28.2 ± 1.1 ms 28.6 ± 1.2 ms 0.985 ± 0.054
centrality/graphs/closeness_centrality 20.9 ± 0.33 ms 21.2 ± 0.45 ms 0.989 ± 0.026
centrality/graphs/degree_centrality 1.47 ± 0.13 μs 1.47 ± 0.12 μs 1 ± 0.12
centrality/graphs/katz_centrality 1 ± 0.055 ms 1 ± 0.044 ms 1 ± 0.071
connectivity/digraphs/strongly_connected_components 0.0432 ± 0.001 ms 0.043 ± 0.0013 ms 1 ± 0.038
connectivity/graphs/connected_components 23.7 ± 0.57 μs 24 ± 0.73 μs 0.987 ± 0.038
core/edges/digraphs 7.86 ± 0.029 μs 7.17 ± 0.011 μs 1.1 ± 0.0044
core/edges/graphs 15.7 ± 0.17 μs 15.6 ± 0.08 μs 1 ± 0.012
core/has_edge/digraphs 5.15 ± 0.31 μs 5.09 ± 0.34 μs 1.01 ± 0.091
core/has_edge/graphs 5.59 ± 0.36 μs 5.5 ± 0.36 μs 1.02 ± 0.094
core/nv/digraphs 0.361 ± 0.01 μs 0.361 ± 0.01 μs 1 ± 0.039
core/nv/graphs 0.39 ± 0.01 μs 0.38 ± 0.01 μs 1.03 ± 0.038
edges/fille 7.81 ± 0.73 μs 7.33 ± 0.8 μs 1.07 ± 0.15
edges/fillp 4.71 ± 3.6 μs 4.61 ± 3.6 μs 1.02 ± 1.1
edges/tsume 2.48 ± 0.02 μs 2.5 ± 0.03 μs 0.988 ± 0.014
edges/tsump 2.5 ± 0.079 μs 2.61 ± 0.091 μs 0.958 ± 0.045
insertions/SG(n,e) Generation 24.9 ± 3.4 ms 26.5 ± 3.6 ms 0.94 ± 0.18
parallel/egonet/twohop 0.283 ± 0.0019 s 0.283 ± 0.0022 s 1 ± 0.01
parallel/egonet/vertexfunction 2.18 ± 0.088 ms 2.25 ± 0.086 ms 0.97 ± 0.054
serial/egonet/twohop 0.3 ± 0.017 s 0.283 ± 0.0013 s 1.06 ± 0.059
serial/egonet/vertexfunction 2.21 ± 0.2 ms 2.19 ± 0.081 ms 1.01 ± 0.098
traversals/digraphs/bfs_tree 0.0492 ± 0.0043 ms 0.049 ± 0.0033 ms 1 ± 0.11
traversals/digraphs/dfs_tree 0.0633 ± 0.008 ms 0.0636 ± 0.006 ms 0.995 ± 0.16
traversals/graphs/bfs_tree 0.0526 ± 0.0018 ms 0.0525 ± 0.0018 ms 1 ± 0.049
traversals/graphs/dfs_tree 0.0653 ± 0.003 ms 0.0652 ± 0.0023 ms 1 ± 0.058
time_to_load 0.52 ± 0.0019 s 0.52 ± 0.0027 s 1 ± 0.0064
Memory benchmarks
master a564fd1... master / a564fd1...
centrality/digraphs/betweenness_centrality 0.29 M allocs: 24 MB 0.29 M allocs: 24 MB 1
centrality/digraphs/closeness_centrality 18.6 k allocs: 14.5 MB 18.6 k allocs: 14.5 MB 1
centrality/digraphs/degree_centrality 8 allocs: 5.01 kB 8 allocs: 5.01 kB 1
centrality/digraphs/katz_centrality 2.63 k allocs: 2.83 MB 2.63 k allocs: 2.83 MB 1
centrality/digraphs/pagerank 21 allocs: 14.9 kB 21 allocs: 14.9 kB 1
centrality/graphs/betweenness_centrality 0.545 M allocs: 0.0313 GB 0.545 M allocs: 0.0313 GB 1
centrality/graphs/closeness_centrality 19.3 k allocs: 14 MB 19.3 k allocs: 14 MB 1
centrality/graphs/degree_centrality 10 allocs: 5.43 kB 10 allocs: 5.43 kB 1
centrality/graphs/katz_centrality 2.96 k allocs: 3.1 MB 2.96 k allocs: 3.1 MB 1
connectivity/digraphs/strongly_connected_components 1.05 k allocs: 0.075 MB 1.05 k allocs: 0.075 MB 1
connectivity/graphs/connected_components 0.061 k allocs: 22.5 kB 0.061 k allocs: 22.5 kB 1
core/edges/digraphs 3 allocs: 0.0938 kB 3 allocs: 0.0938 kB 1
core/edges/graphs 3 allocs: 0.0938 kB 3 allocs: 0.0938 kB 1
core/has_edge/digraphs 20 allocs: 12.6 kB 20 allocs: 12.6 kB 1
core/has_edge/graphs 28 allocs: 13.8 kB 28 allocs: 13.8 kB 1
core/nv/digraphs 3 allocs: 0.0938 kB 3 allocs: 0.0938 kB 1
core/nv/graphs 3 allocs: 0.0938 kB 3 allocs: 0.0938 kB 1
edges/fille 3 allocs: 0.153 MB 3 allocs: 0.153 MB 1
edges/fillp 3 allocs: 0.153 MB 3 allocs: 0.153 MB 1
edges/tsume 0 allocs: 0 B 0 allocs: 0 B
edges/tsump 0 allocs: 0 B 0 allocs: 0 B
insertions/SG(n,e) Generation 0.0465 M allocs: 10.9 MB 0.0466 M allocs: 11 MB 0.997
parallel/egonet/twohop 10 allocs: 0.0768 MB 10 allocs: 0.0768 MB 1
parallel/egonet/vertexfunction 10 allocs: 0.0768 MB 10 allocs: 0.0768 MB 1
serial/egonet/twohop 3 allocs: 0.0764 MB 3 allocs: 0.0764 MB 1
serial/egonet/vertexfunction 3 allocs: 0.0764 MB 3 allocs: 0.0764 MB 1
traversals/digraphs/bfs_tree 2.34 k allocs: 0.113 MB 2.34 k allocs: 0.113 MB 1
traversals/digraphs/dfs_tree 2.44 k allocs: 0.118 MB 2.44 k allocs: 0.118 MB 1
traversals/graphs/bfs_tree 2.52 k allocs: 0.121 MB 2.52 k allocs: 0.121 MB 1
traversals/graphs/dfs_tree 2.63 k allocs: 0.127 MB 2.63 k allocs: 0.127 MB 1
time_to_load 0.145 k allocs: 11 kB 0.145 k allocs: 11 kB 1

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.28%. Comparing base (82fee84) to head (a564fd1).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #493      +/-   ##
==========================================
- Coverage   97.30%   97.28%   -0.02%     
==========================================
  Files         123      123              
  Lines        7378     7406      +28     
==========================================
+ Hits         7179     7205      +26     
- Misses        199      201       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Copy link
Copy Markdown
Member

@Krastanov Krastanov left a comment

Choose a reason for hiding this comment

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

As the human behind this agent, I approve of this PR and confirm I have reviewed it.

Julia 1.13 changes the iteration order of Set and Dict, causing
doctest failures where output order is non-deterministic.

Use doctest filters to skip comparison of output lines whose order
depends on Set/Dict iteration, keeping the original readable code
in the docstrings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Krastanov Krastanov merged commit b593c8e into JuliaGraphs:master Feb 23, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants