passagemath-cliquer 10.6.32__cp314-cp314t-musllinux_1_2_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,111 @@
1
+ Metadata-Version: 2.4
2
+ Name: passagemath-cliquer
3
+ Version: 10.6.32
4
+ Summary: passagemath: Finding cliques in graphs with cliquer
5
+ Author-email: The Sage Developers <sage-support@googlegroups.com>
6
+ Maintainer: Matthias Köppe, passagemath contributors
7
+ License-Expression: GPL-2.0-or-later
8
+ Project-URL: release notes, https://github.com/passagemath/passagemath/releases
9
+ Project-URL: repo (upstream), https://github.com/sagemath/sage
10
+ Project-URL: repo, https://github.com/passagemath/passagemath
11
+ Project-URL: documentation, https://passagemath.org/docs/latest
12
+ Project-URL: homepage (upstream), https://www.sagemath.org
13
+ Project-URL: discourse, https://passagemath.discourse.group
14
+ Project-URL: tracker (upstream), https://github.com/sagemath/sage/issues
15
+ Project-URL: tracker, https://github.com/passagemath/passagemath/issues
16
+ Classifier: Development Status :: 6 - Mature
17
+ Classifier: Intended Audience :: Education
18
+ Classifier: Intended Audience :: Science/Research
19
+ Classifier: Operating System :: POSIX
20
+ Classifier: Operating System :: POSIX :: Linux
21
+ Classifier: Operating System :: MacOS :: MacOS X
22
+ Classifier: Operating System :: Microsoft :: Windows
23
+ Classifier: Programming Language :: Python :: 3 :: Only
24
+ Classifier: Programming Language :: Python :: 3.10
25
+ Classifier: Programming Language :: Python :: 3.11
26
+ Classifier: Programming Language :: Python :: 3.12
27
+ Classifier: Programming Language :: Python :: 3.13
28
+ Classifier: Programming Language :: Python :: Implementation :: CPython
29
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
30
+ Requires-Python: <3.15,>=3.10
31
+ Description-Content-Type: text/x-rst
32
+ Provides-Extra: test
33
+ Requires-Dist: passagemath-graphs; extra == "test"
34
+ Requires-Dist: passagemath-repl; extra == "test"
35
+
36
+ ===============================================================================
37
+ passagemath: Finding cliques in graphs with cliquer
38
+ ===============================================================================
39
+
40
+ `passagemath <https://github.com/passagemath/passagemath>`__ is open
41
+ source mathematical software in Python, released under the GNU General
42
+ Public Licence GPLv2+.
43
+
44
+ It is a fork of `SageMath <https://www.sagemath.org/>`__, which has been
45
+ developed 2005-2025 under the motto “Creating a Viable Open Source
46
+ Alternative to Magma, Maple, Mathematica, and MATLAB”.
47
+
48
+ The passagemath fork uses the motto "Creating a Free Passage Between the
49
+ Scientific Python Ecosystem and Mathematical Software Communities."
50
+ It was created in October 2024 with the following goals:
51
+
52
+ - providing modularized installation with pip,
53
+ - establishing first-class membership in the scientific Python
54
+ ecosystem,
55
+ - giving `clear attribution of upstream
56
+ projects <https://groups.google.com/g/sage-devel/c/6HO1HEtL1Fs/m/G002rPGpAAAJ>`__,
57
+ - providing independently usable Python interfaces to upstream
58
+ libraries,
59
+ - offering `platform portability and integration testing
60
+ services <https://github.com/passagemath/passagemath/issues/704>`__
61
+ to upstream projects,
62
+ - inviting collaborations with upstream projects,
63
+ - `building a professional, respectful, inclusive
64
+ community <https://groups.google.com/g/sage-devel/c/xBzaINHWwUQ>`__,
65
+ - `empowering Sage users to participate in the scientific Python ecosystem
66
+ <https://github.com/passagemath/passagemath/issues/248>`__ by publishing packages,
67
+ - developing a port to `Pyodide <https://pyodide.org/en/stable/>`__ for
68
+ serverless deployment with Javascript,
69
+ - developing a native Windows port.
70
+
71
+ `Full documentation <https://passagemath.org/docs/latest/html/en/index.html>`__ is
72
+ available online.
73
+
74
+ passagemath attempts to support and provides binary wheels suitable for
75
+ all major Linux distributions and recent versions of macOS.
76
+
77
+ Binary wheels for native Windows (x86_64) are are available for a subset of
78
+ the passagemath distributions. Use of the full functionality of passagemath
79
+ on Windows currently requires the use of Windows Subsystem for Linux (WSL)
80
+ or virtualization.
81
+
82
+ The supported Python versions in the passagemath 10.6.x series are 3.10.x-3.13.x.
83
+
84
+
85
+ About this pip-installable distribution package
86
+ -----------------------------------------------
87
+
88
+ This pip-installable distribution ``passagemath-cliquer`` provides an interface
89
+ to `cliquer <https://users.aalto.fi/~pat/cliquer.html>`_, an exact branch-and-bound
90
+ algorithm for finding cliques in an arbitrary weighted graph by Patric Östergård.
91
+
92
+
93
+ What is included
94
+ ----------------
95
+
96
+ * `Cython interface to cliquer <https://passagemath.org/docs/latest/html/en/reference/graphs/sage/graphs/cliquer.html>`_
97
+
98
+
99
+ Examples
100
+ --------
101
+
102
+ ::
103
+
104
+ $ pipx run --pip-args="--prefer-binary" --spec "passagemath-cliquer[test]" ipython
105
+
106
+ In [1]: from sage.all__sagemath_cliquer import *
107
+
108
+ In [2]: from sage.graphs.cliquer import max_clique
109
+
110
+ In [3]: C = graphs.PetersenGraph(); max_clique(C)
111
+ Out[3]: [7, 9]
@@ -0,0 +1,10 @@
1
+ passagemath_cliquer.libs/libcliquer-c696efef.so.1.0.21,sha256=COT0CWjr0I9CI9yUwoiWLFnteviFivzfqX7ljbhwHXI,143049
2
+ sage/all__sagemath_cliquer.py,sha256=jBej4FzxkgjVdTK_hCm3u9rgoYX3_PAHa2mZXK8KvUM,107
3
+ sage/graphs/all__sagemath_cliquer.py,sha256=Rby8pG2esTxBpJcnmT0FiU_RsBsT_mzMEXds-AjXrUI,46
4
+ sage/graphs/cliquer.cpython-314t-x86_64-linux-musl.so,sha256=amSDBULbgH62IY8El9izQhQ0yByu0HmsuHk398CCGiw,722673
5
+ sage/graphs/cliquer.pxd,sha256=NTJnYsne4hPSF65aG6CayHmkTJ3NwEJkngGTV3M7uQ0,654
6
+ sage/graphs/cliquer.pyx,sha256=H2IMZxZu8xeKynaefRM6_8zzCu-w4TVAtcrwp-07Z_U,9640
7
+ passagemath_cliquer-10.6.32.dist-info/METADATA,sha256=-iyLt_HaSz2DKoGLEbdqa8XEXawCu4y3KOSlyfdDhGk,4831
8
+ passagemath_cliquer-10.6.32.dist-info/WHEEL,sha256=zXoM281zyz8wppofreMuq3eZjd9HP4BgZS1rfYnrpIs,113
9
+ passagemath_cliquer-10.6.32.dist-info/top_level.txt,sha256=Kmzulf9WsphADFQuqgvdy5mvTLDj_V2zkFHU2s3UXos,6
10
+ passagemath_cliquer-10.6.32.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp314-cp314t-musllinux_1_2_x86_64
5
+
@@ -0,0 +1,2 @@
1
+
2
+ sage
@@ -0,0 +1,4 @@
1
+ # sage_setup: distribution = sagemath-cliquer
2
+ # delvewheel: patch
3
+
4
+ from sage.all__sagemath_graphs import *
@@ -0,0 +1 @@
1
+ # sage_setup: distribution = sagemath-cliquer
@@ -0,0 +1,19 @@
1
+ # sage_setup: distribution = sagemath-cliquer
2
+ # distutils: libraries = cliquer
3
+
4
+ cdef extern from "cliquer/graph.h":
5
+ ctypedef struct graph_t
6
+
7
+ cdef graph_t * graph_new(int n)
8
+ cdef void graph_print(graph_t *g)
9
+ cdef void graph_free(graph_t *g)
10
+ cdef void GRAPH_ADD_EDGE(graph_t *g, int, int)
11
+
12
+ cdef extern from "cliquer/cliquer.h":
13
+ struct clique_options
14
+
15
+ bint clique_print_time(intlevel, int i, int n, int max, double cputime, double realtime, clique_options *opts)
16
+
17
+ cdef extern from "cliquer/reorder.h":
18
+ cdef int *reorder_by_greedy_coloring(graph_t *g, bint weighted)
19
+ cdef int *reorder_by_degree(graph_t *g, bint weighted)
@@ -0,0 +1,331 @@
1
+ # sage_setup: distribution = sagemath-cliquer
2
+ # cython: binding=True
3
+ r"""
4
+ Interface with Cliquer (clique-related problems)
5
+
6
+ This module defines functions based on Cliquer, an exact
7
+ branch-and-bound algorithm developed by Patric R. J. Ostergard and
8
+ written by Sampo Niskanen.
9
+
10
+ AUTHORS:
11
+
12
+ - Nathann Cohen (2009-08-14): Initial version
13
+
14
+ - Jeroen Demeyer (2011-05-06): Make cliquer interruptible (:issue:`11252`)
15
+
16
+ - Nico Van Cleemput (2013-05-27): Handle the empty graph (:issue:`14525`)
17
+
18
+ REFERENCE:
19
+
20
+ [NO2003]_
21
+
22
+ Methods
23
+ -------
24
+ """
25
+
26
+ # ****************************************************************************
27
+ # Copyright (C) 2009 Nathann Cohen <nathann.cohen@gmail.com>
28
+ #
29
+ # Distributed under the terms of the GNU General Public License (GPL)
30
+ # as published by the Free Software Foundation; either version 2 of
31
+ # the License, or (at your option) any later version.
32
+ # https://www.gnu.org/licenses/
33
+ # ****************************************************************************
34
+
35
+ from cysignals.memory cimport sig_free
36
+ from cysignals.signals cimport sig_on, sig_off
37
+
38
+
39
+ cdef extern from "cliquer/cl.c":
40
+ cdef int sage_clique_max(graph_t *g, int ** list_of_vertices)
41
+ cdef int sage_all_clique_max(graph_t *g, int ** list_of_vertices)
42
+ cdef int sage_clique_number(graph_t *g)
43
+ cdef int sage_find_all_clique(graph_t *g, int ** list_of_vertices, int min_size, int max_size)
44
+
45
+
46
+ def max_clique(graph):
47
+ """
48
+ Return the vertex set of a maximum complete subgraph.
49
+
50
+ .. NOTE::
51
+
52
+ Currently only implemented for undirected graphs. Use
53
+ :meth:`~sage.graphs.digraph.DiGraph.to_undirected` to convert a digraph
54
+ to an undirected graph.
55
+
56
+ EXAMPLES::
57
+
58
+ sage: C = graphs.PetersenGraph()
59
+ sage: from sage.graphs.cliquer import max_clique
60
+ sage: max_clique(C)
61
+ [7, 9]
62
+
63
+ TESTS::
64
+
65
+ sage: g = Graph()
66
+ sage: g.clique_maximum()
67
+ []
68
+ """
69
+ if not graph.order():
70
+ return []
71
+
72
+ cdef int i
73
+ cdef list int_to_vertex = list(graph)
74
+ cdef dict vertex_to_int = {v: i for i, v in enumerate(int_to_vertex)}
75
+
76
+ cdef graph_t* g = graph_new(graph.order())
77
+ for u, v in graph.edge_iterator(labels=None):
78
+ GRAPH_ADD_EDGE(g, vertex_to_int[u], vertex_to_int[v])
79
+
80
+ cdef int* list_of_vertices
81
+ cdef int size
82
+ sig_on()
83
+ size = sage_clique_max(g, &list_of_vertices)
84
+ sig_off()
85
+ cdef list b = [int_to_vertex[list_of_vertices[i]] for i in range(size)]
86
+
87
+ sig_free(list_of_vertices)
88
+ graph_free(g)
89
+ return b
90
+
91
+
92
+ # computes all the maximum clique of a graph and return its list
93
+
94
+ def all_max_clique(graph):
95
+ """
96
+ Return the vertex sets of *ALL* the maximum complete subgraphs.
97
+
98
+ Returns the list of all maximum cliques, with each clique represented by a
99
+ list of vertices. A clique is an induced complete subgraph, and a maximum
100
+ clique is one of maximal order.
101
+
102
+ .. NOTE::
103
+
104
+ Currently only implemented for undirected graphs. Use
105
+ :meth:`~sage.graphs.digraph.DiGraph.to_undirected` to convert a digraph
106
+ to an undirected graph.
107
+
108
+ ALGORITHM:
109
+
110
+ This function is based on Cliquer [NO2003]_.
111
+
112
+ EXAMPLES::
113
+
114
+ sage: graphs.ChvatalGraph().cliques_maximum() # indirect doctest
115
+ [[0, 1], [0, 4], [0, 6], [0, 9], [1, 2], [1, 5], [1, 7], [2, 3],
116
+ [2, 6], [2, 8], [3, 4], [3, 7], [3, 9], [4, 5], [4, 8], [5, 10],
117
+ [5, 11], [6, 10], [6, 11], [7, 8], [7, 11], [8, 10], [9, 10], [9, 11]]
118
+ sage: G = Graph({0:[1,2,3], 1:[2], 3:[0,1]})
119
+ sage: G.show(figsize=[2,2]) # needs sage.plot
120
+ sage: G.cliques_maximum()
121
+ [[0, 1, 2], [0, 1, 3]]
122
+ sage: C = graphs.PetersenGraph()
123
+ sage: C.cliques_maximum()
124
+ [[0, 1], [0, 4], [0, 5], [1, 2], [1, 6], [2, 3], [2, 7], [3, 4],
125
+ [3, 8], [4, 9], [5, 7], [5, 8], [6, 8], [6, 9], [7, 9]]
126
+ sage: C = Graph('DJ{')
127
+ sage: C.cliques_maximum()
128
+ [[1, 2, 3, 4]]
129
+
130
+ TESTS::
131
+
132
+ sage: g = Graph()
133
+ sage: g.cliques_maximum()
134
+ [[]]
135
+ """
136
+ if not graph.order():
137
+ return [[]]
138
+
139
+ cdef int i
140
+ cdef list int_to_vertex = list(graph)
141
+ cdef dict vertex_to_int = {v: i for i, v in enumerate(int_to_vertex)}
142
+
143
+ cdef graph_t* g = graph_new(graph.order())
144
+ for u, v in graph.edge_iterator(labels=None):
145
+ GRAPH_ADD_EDGE(g, vertex_to_int[u], vertex_to_int[v])
146
+
147
+ cdef int* list_of_vertices
148
+ cdef int size
149
+ sig_on()
150
+ size = sage_all_clique_max(g, &list_of_vertices)
151
+ sig_off()
152
+ cdef list b = []
153
+ cdef list c = []
154
+ for i in range(size):
155
+ if list_of_vertices[i] != -1:
156
+ c.append(int_to_vertex[list_of_vertices[i]])
157
+ else:
158
+ b.append(c)
159
+ c = []
160
+
161
+ sig_free(list_of_vertices)
162
+ graph_free(g)
163
+
164
+ return sorted(b)
165
+
166
+
167
+ def all_cliques(graph, min_size=0, max_size=0):
168
+ r"""
169
+ Iterator over the cliques in ``graph``.
170
+
171
+ A clique is an induced complete subgraph. This method is an iterator over
172
+ all the cliques with size in between ``min_size`` and ``max_size``. By
173
+ default, this method returns only maximum cliques. Each yielded clique is
174
+ represented by a list of vertices.
175
+
176
+ .. NOTE::
177
+
178
+ Currently only implemented for undirected graphs. Use
179
+ :meth:`~sage.graphs.digraph.DiGraph.to_undirected` to convert a digraph
180
+ to an undirected graph.
181
+
182
+ INPUT:
183
+
184
+ - ``min_size`` -- integer (default: 0); minimum size of reported cliques.
185
+ When set to 0 (default), this method searches for maximum cliques. In such
186
+ case, parameter ``max_size`` must also be set to 0.
187
+
188
+ - ``max_size`` -- integer (default: 0); maximum size of reported cliques.
189
+ When set to 0 (default), the maximum size of the cliques is unbounded.
190
+ When ``min_size`` is set to 0, this parameter must be set to 0.
191
+
192
+ ALGORITHM:
193
+
194
+ This function is based on Cliquer [NO2003]_.
195
+
196
+ EXAMPLES::
197
+
198
+ sage: G = graphs.CompleteGraph(5)
199
+ sage: list(sage.graphs.cliquer.all_cliques(G))
200
+ [[0, 1, 2, 3, 4]]
201
+ sage: list(sage.graphs.cliquer.all_cliques(G, 2, 3))
202
+ [[3, 4],
203
+ [2, 3],
204
+ [2, 3, 4],
205
+ [2, 4],
206
+ [1, 2],
207
+ [1, 2, 3],
208
+ [1, 2, 4],
209
+ [1, 3],
210
+ [1, 3, 4],
211
+ [1, 4],
212
+ [0, 1],
213
+ [0, 1, 2],
214
+ [0, 1, 3],
215
+ [0, 1, 4],
216
+ [0, 2],
217
+ [0, 2, 3],
218
+ [0, 2, 4],
219
+ [0, 3],
220
+ [0, 3, 4],
221
+ [0, 4]]
222
+ sage: G.delete_edge([1,3])
223
+ sage: list(sage.graphs.cliquer.all_cliques(G))
224
+ [[0, 2, 3, 4], [0, 1, 2, 4]]
225
+
226
+ TESTS::
227
+
228
+ sage: G = graphs.CompleteGraph(3)
229
+ sage: list(sage.graphs.cliquer.all_cliques(G, 2, 3))
230
+ [[1, 2], [0, 1], [0, 1, 2], [0, 2]]
231
+
232
+ sage: G = graphs.EmptyGraph()
233
+ sage: list(sage.graphs.cliquer.all_cliques(G, 2, 3))
234
+ []
235
+
236
+ sage: G = Graph([(0, 1), (0, 1)], multiedges=True)
237
+ sage: list(sage.graphs.cliquer.all_cliques(G, 2, 2))
238
+ [[0, 1]]
239
+
240
+ sage: list(sage.graphs.cliquer.all_cliques(G, 0, 2))
241
+ Traceback (most recent call last):
242
+ ...
243
+ ValueError: max_size > 0 is incompatible with min_size == 0
244
+
245
+ .. TODO::
246
+
247
+ Use the re-entrant functionality of Cliquer [NO2003]_ to avoid storing
248
+ all cliques.
249
+ """
250
+ if not min_size and max_size > 0:
251
+ raise ValueError("max_size > 0 is incompatible with min_size == 0")
252
+ if not graph:
253
+ return
254
+
255
+ cdef int i
256
+ cdef list int_to_vertex = list(graph)
257
+ cdef dict vertex_to_int = {v: i for i, v in enumerate(int_to_vertex)}
258
+
259
+ cdef graph_t* g = graph_new(graph.order())
260
+ for u, v in graph.edge_iterator(labels=None):
261
+ GRAPH_ADD_EDGE(g, vertex_to_int[u], vertex_to_int[v])
262
+
263
+ cdef int* list_of_vertices
264
+ cdef int size = 0
265
+ cdef list c
266
+ try:
267
+ try:
268
+ sig_on()
269
+ size = sage_find_all_clique(g, &list_of_vertices, min_size, max_size)
270
+ sig_off()
271
+ finally:
272
+ graph_free(g)
273
+ c = []
274
+ for i in range(size):
275
+ if list_of_vertices[i] != -1:
276
+ c.append(int_to_vertex[list_of_vertices[i]])
277
+ else:
278
+ yield c
279
+ c = []
280
+ finally:
281
+ if list_of_vertices:
282
+ # We free ``list_of_vertices``,
283
+ # but only if previous computations weren't interrupted before
284
+ # allocating memory for ``list_of_vertices``.
285
+ sig_free(list_of_vertices)
286
+
287
+
288
+ # computes the clique number of a graph
289
+
290
+ def clique_number(graph):
291
+ """
292
+ Return the size of the largest clique of the graph (clique number).
293
+
294
+ .. NOTE::
295
+
296
+ Currently only implemented for undirected graphs. Use
297
+ :meth:`~sage.graphs.digraph.DiGraph.to_undirected` to convert a digraph
298
+ to an undirected graph.
299
+
300
+ EXAMPLES::
301
+
302
+ sage: C = Graph('DJ{')
303
+ sage: C.clique_number()
304
+ 4
305
+ sage: G = Graph({0:[1,2,3], 1:[2], 3:[0,1]})
306
+ sage: G.show(figsize=[2,2]) # needs sage.plot
307
+ sage: G.clique_number()
308
+ 3
309
+
310
+ TESTS::
311
+
312
+ sage: g = Graph()
313
+ sage: g.clique_number()
314
+ 0
315
+ """
316
+ if not graph.order():
317
+ return 0
318
+
319
+ cdef int i
320
+ cdef dict vertex_to_int = {v: i for i, v in enumerate(graph)}
321
+
322
+ cdef graph_t* g = graph_new(graph.order())
323
+ for u, v in graph.edge_iterator(labels=None):
324
+ GRAPH_ADD_EDGE(g, vertex_to_int[u], vertex_to_int[v])
325
+
326
+ cdef int c
327
+ sig_on()
328
+ c = sage_clique_number(g)
329
+ graph_free(g)
330
+ sig_off()
331
+ return c