Skip to content

Add VNAlgorithm and dispatch clique_number to very_nauty - #37

Closed
singhharsh1708 wants to merge 1 commit into
JuliaGraphs:masterfrom
singhharsh1708:feat/vnalgorithm
Closed

singhharsh1708 wants to merge 1 commit into
JuliaGraphs:masterfrom
singhharsh1708:feat/vnalgorithm

Conversation

@singhharsh1708

@singhharsh1708 singhharsh1708 commented Sep 7, 2026 •

Copy link
Copy Markdown

Adds VNAlgorithm and the first operation dispatched through it: clique_number(g, ::VNAlgorithm) converts to a VNGraph when it has to and calls graph_clique_number, where Graphs.jl otherwise enumerates every maximal clique and takes the longest.

This is not a faster implementation, it is a different one worth being able to select. On dense graphs the C routine wins, 13.4 ms against 33.7 ms at 60 vertices and edge probability 0.7. At probability 0.5 it loses, 8.1 ms against 4.6 ms at 60 vertices and 14.8 against 8.8 at 70. The answers always agree: on all 54 random graphs I measured across sizes 10 to 80 and densities 0.3 to 0.9, and the test draws 30 fresh random graphs on every run along with the complete graph, a path, an edgeless graph and a single vertex.

very_nauty keeps its clique search state in a file scope global, so concurrent calls corrupt each other: four threads making 400 calls segfaulted the process. The C call is therefore made under a package lock, and the test runs 64 calls across threads, which CI exercises at t=2.

The directed case needs a guard. Graphs.clique_number refuses a directed graph through its !IsDirected trait, but VNGraph(::AbstractSimpleGraph) accepts a SimpleDiGraph and quietly drops the direction, so without the check this method would answer for the underlying undirected graph where Graphs.jl errors. That conversion accepting a digraph at all looks wrong to me, but changing it belongs in its own PR.

clique_number entered Graphs.jl in 1.14, so the [compat] floor moves from 1.12 to 1.14. On the empty graph the C routine returns 0 where Graphs.jl throws, and the test pins the 0. 180 tests pass on 1.10; removing the block leaves the test failing on UndefVarError: VNAlgorithm.

Overlap I should flag rather than let you find: #26 also introduces a VNAlgorithm and dispatches clique_number, along with chromatic numbers, connected components, a README rewrite and benchmarks. It has been unchanged since April, after you asked for it to be split. This is that split, as one operation, with the agreement and timing measured.

The red lanes here are red on master too, for missing files and a runner architecture this does not touch.

Part of JuliaGraphs/Graphs.jl#448, independent of #33 to #36.

AI Disclosure: Claude assisted with the code. Testing and review by @singhharsh1708.

@codecov

codecov Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.23%. Comparing base (0fa35cb) to head (03eafef).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #37      +/-   ##
==========================================
+ Coverage   45.90%   52.23%   +6.33%     
==========================================
  Files           1        1              
  Lines          61       67       +6     
==========================================
+ Hits           28       35       +7     
+ Misses         33       32       -1     

☔ View full report in Codecov by Harness.
📢 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.

@Krastanov

Copy link
Copy Markdown
Member

LLM work from new contributors is not acceptable for bounties

@Krastanov Krastanov closed this Sep 12, 2026
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