passagemath-mcqd
raw JSON → 10.8.4 verified Fri May 01 auth: no python
The passagemath-mcqd library provides a Python interface to the MCQD algorithm for finding maximum cliques in undirected graphs. It is part of the passagemath ecosystem and currently at version 10.8.4, supporting Python 3.11 through 3.14. Release cadence is tied to the parent passagemath project.
pip install passagemath-mcqd Common errors
error ImportError: cannot import name 'mcqd' from 'passagemath.mcqd' ↓
cause Incorrect import path. The mcqd function is not directly in passagemath.mcqd; it is accessed via Sage's graph module.
fix
Use 'from sage.graphs.cliquer import mcqd'
error TypeError: mcqd() takes exactly one argument (0 given) ↓
cause The function requires a Sage Graph object as argument. No default graph.
fix
Call mcqd(G) where G is a sage.graphs.graph.Graph.
error AttributeError: 'list' object has no attribute 'vertices' ↓
cause Assuming mcqd returns a graph object instead of a list of vertex indices.
fix
mcqd returns a list of indices. Use G.vertices() to map to labels.
Warnings
gotcha The mcqd function expects a Sage Graph object, not a NetworkX graph or other structure. ↓
fix Convert your graph using Graph(nx_graph) from sage.graphs.graph.
gotcha The function returns a list of vertex indices, not vertex labels. The indices correspond to the internal order of vertices in the graph. ↓
fix Use G.vertices() to map indices back to labels: [G.vertices()[i] for i in mcqd(G)].
deprecated The function is imported from sage.graphs.cliquer, not from any passagemath-specific module. The passagemath-mcqd package installs the necessary binaries but the import path remains the Sage one. ↓
fix Use 'from sage.graphs.cliquer import mcqd'.
Imports
- mcqd wrong
from passagemath.mcqd import mcqdcorrectfrom sage.graphs.cliquer import mcqd
Quickstart
import os
from sage.graphs.cliquer import mcqd
import sage.graphs.graph as graph
G = graph.Graph([(0,1),(1,2),(2,0),(0,3)])
clique = mcqd(G)
print('Maximum clique:', clique)