passagemath-cliquer

raw JSON →
10.8.4 verified Fri May 01 auth: no python

A SageMath wrapper for the Cliquer library to find maximum cliques and enumerate cliques in graphs. Version 10.8.4 requires Python 3.11 to <3.15. Release cadence follows passagemath releases.

pip install passagemath-cliquer
error ModuleNotFoundError: No module named 'sage.graphs.cliquer'
cause passagemath-cliquer not installed or passagemath runtime not set up.
fix
Run: pip install passagemath-cliquer
error ImportError: cannot import name 'CliquerBackend' from 'sage.graphs.cliquer'
cause Older version of passagemath where CliquerBackend doesn't exist.
fix
Upgrade passagemath and passagemath-cliquer to >=10.8.
error ValueError: the graph must be an instance of Graph
cause Passed a non-Graph object to CliquerBackend constructor.
fix
Ensure input is a sage Graph object: from sage.graphs.graph import Graph
breaking passagemath-cliquer 10.8+ drops support for Python < 3.11. Ensure your environment uses Python 3.11-3.14.
fix Upgrade Python to 3.11 or later.
gotcha The library is installed as passagemath-cliquer but the import path is sage.graphs.cliquer. Do not attempt to import directly from passagemath.cliquer.
fix Use 'from sage.graphs.cliquer import ...'
deprecated The older Cliquer function 'cliquer_max_clique' (lowercase) was deprecated and may be removed. Use CliquerBackend methods.
fix Use CliquerBackend.clique_max() instead.

Create a graph and use CliquerBackend to find a maximum clique.

from sage.graphs.cliquer import CliquerBackend
from sage.graphs.graph import Graph

g = Graph(5)
g.add_edges([(0,1),(1,2),(2,3),(3,4),(0,2)])
backend = CliquerBackend(g)
# Find a maximum clique
max_clique = backend.clique_max()
print(max_clique)