passagemath-tdlib 10.6.37__cp312-abi3-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,3 @@
1
+ # sage_setup: distribution = sagemath-tdlib
2
+
3
+ from sage.all__sagemath_tdlib import *
@@ -0,0 +1,93 @@
1
+ Metadata-Version: 2.4
2
+ Name: passagemath-tdlib
3
+ Version: 10.6.37
4
+ Summary: passagemath: Tree decompositions with tdlib
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: Programming Language :: Python :: 3 :: Only
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Programming Language :: Python :: 3.13
27
+ Classifier: Programming Language :: Python :: 3.14
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
+ Requires-Dist: cysignals<1.12.4; sys_platform == "win32"
33
+ Requires-Dist: cysignals!=1.12.0,>=1.11.2
34
+ Provides-Extra: test
35
+ Requires-Dist: passagemath-repl; extra == "test"
36
+ Requires-Dist: passagemath-graphs; extra == "test"
37
+
38
+ ========================================================================
39
+ passagemath: Tree decompositions with tdlib
40
+ ========================================================================
41
+
42
+ `passagemath <https://github.com/passagemath/passagemath>`__ is open
43
+ source mathematical software in Python, released under the GNU General
44
+ Public Licence GPLv2+.
45
+
46
+ It is a fork of `SageMath <https://www.sagemath.org/>`__, which has been
47
+ developed 2005-2025 under the motto “Creating a Viable Open Source
48
+ Alternative to Magma, Maple, Mathematica, and MATLAB”.
49
+
50
+ The passagemath fork uses the motto "Creating a Free Passage Between the
51
+ Scientific Python Ecosystem and Mathematical Software Communities."
52
+ It was created in October 2024 with the following goals:
53
+
54
+ - providing modularized installation with pip,
55
+ - establishing first-class membership in the scientific Python
56
+ ecosystem,
57
+ - giving `clear attribution of upstream
58
+ projects <https://groups.google.com/g/sage-devel/c/6HO1HEtL1Fs/m/G002rPGpAAAJ>`__,
59
+ - providing independently usable Python interfaces to upstream
60
+ libraries,
61
+ - offering `platform portability and integration testing
62
+ services <https://github.com/passagemath/passagemath/issues/704>`__
63
+ to upstream projects,
64
+ - inviting collaborations with upstream projects,
65
+ - `building a professional, respectful, inclusive
66
+ community <https://groups.google.com/g/sage-devel/c/xBzaINHWwUQ>`__,
67
+ - `empowering Sage users to participate in the scientific Python ecosystem
68
+ <https://github.com/passagemath/passagemath/issues/248>`__ by publishing packages,
69
+ - developing a port to `Pyodide <https://pyodide.org/en/stable/>`__ for
70
+ serverless deployment with Javascript,
71
+ - developing a native Windows port.
72
+
73
+ `Full documentation <https://passagemath.org/docs/latest/html/en/index.html>`__ is
74
+ available online.
75
+
76
+ passagemath attempts to support and provides binary wheels suitable for
77
+ all major Linux distributions and recent versions of macOS.
78
+
79
+ Binary wheels for native Windows (x86_64) are are available for a subset of
80
+ the passagemath distributions. Use of the full functionality of passagemath
81
+ on Windows currently requires the use of Windows Subsystem for Linux (WSL)
82
+ or virtualization.
83
+
84
+ The supported Python versions in the passagemath 10.6.x series are 3.10.x-3.13.x.
85
+
86
+
87
+ About this pip-installable distribution package
88
+ -----------------------------------------------
89
+
90
+ This pip-installable distribution ``passagemath-tdlib`` is a small optional distribution for use with `passagemath-graphs <https://pypi.org/project/passagemath-graphs>`_.
91
+
92
+ It provides a Cython interface to the ``tdlib`` library, now also known as `treedec <https://gitlab.com/freetdi/treedec>`_, providing
93
+ algorithms concerning tree decompositions.
@@ -0,0 +1,12 @@
1
+ passagemath_tdlib/__init__.py,sha256=pkf9WFBA6Z19IKlZZV-KQCzF-WoaEoYoiTPH6nRpfUo,84
2
+ passagemath_tdlib.libs/libgcc_s-0cd532bd.so.1,sha256=QrXyyMoT5eFz2Df1EXoEtsBCQ3VIESveeHklGujc_48,183337
3
+ passagemath_tdlib.libs/libstdc++-5d72f927.so.6.0.33,sha256=i_QxuLSNJcDImiug4WsF5wNgprWyeL3Mc09ILo-0-Dc,3564129
4
+ sage/all__sagemath_tdlib.py,sha256=zag9UqFlkcjkiBCrkeLRFIXjnemsqnpTNJFfqQMezKE,64
5
+ sage/graphs/all__sagemath_tdlib.py,sha256=xwEAp-3HSleZKAjcgudzEBoWekMyMSx7mY9lzHCETcU,44
6
+ sage/graphs/graph_decompositions/all__sagemath_tdlib.py,sha256=xwEAp-3HSleZKAjcgudzEBoWekMyMSx7mY9lzHCETcU,44
7
+ sage/graphs/graph_decompositions/tdlib.abi3.so,sha256=EJFrrxCXj66SdsJzQUC9AZW2jB3OIGzQ3UEwla1Aq0g,5485377
8
+ sage/graphs/graph_decompositions/tdlib.pyx,sha256=hTSyIq_Va3AV1GzwepFuTGzNC77BhtPvSlLj1lOmM8M,5381
9
+ passagemath_tdlib-10.6.37.dist-info/METADATA,sha256=jjXGxr7Lzcosd4ULVlliwfPRhiZIoSQIpgWpvuk9_Tk,4549
10
+ passagemath_tdlib-10.6.37.dist-info/WHEEL,sha256=GIYi8yqodGXJf5_lS9HYm_ZYguPz6DgSMeewkgTvr7Y,111
11
+ passagemath_tdlib-10.6.37.dist-info/top_level.txt,sha256=udVnGv8qRS4FCMdRgHx9y78553ikEdpWqhJa1_KYX-I,24
12
+ passagemath_tdlib-10.6.37.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: cp312-abi3-musllinux_1_2_x86_64
5
+
@@ -0,0 +1,3 @@
1
+
2
+ passagemath_tdlib
3
+ sage
@@ -0,0 +1,2 @@
1
+ # sage_setup: distribution = sagemath-tdlib
2
+ # delvewheel: patch
@@ -0,0 +1 @@
1
+ # sage_setup: distribution = sagemath-tdlib
@@ -0,0 +1 @@
1
+ # sage_setup: distribution = sagemath-tdlib
@@ -0,0 +1,185 @@
1
+ # distutils: language = c++
2
+ # distutils: extra_compile_args = -std=c++17
3
+ # sage_setup: distribution = sagemath-tdlib
4
+
5
+ r"""
6
+ Interface with TdLib (algorithms for tree decompositions)
7
+
8
+ This module defines functions based on TdLib, a library that implements
9
+ algorithms for tree decompositions written by Lukas Larisch.
10
+
11
+ **Definition** :
12
+
13
+ A `tree decomposition` of a graph `G` is a pair `(T, \beta)` consisting of a
14
+ tree T and a function `\beta: V(T) \rightarrow 2^{V(G)}` associating with each
15
+ node `t \in V(T)` a set of vertices `\beta (t) \subseteq V(G)` such that
16
+
17
+ * (T1) for every edge `e \in E(G)` there is a node `t \in V(T)` with `e
18
+ \subseteq \beta (t)`, and
19
+
20
+ * (T2) for all `v \in V(G)` the set `\beta^{-1} := \{t \in V(T): v \in \beta
21
+ (t)\}` is non-empty and connected in T.
22
+
23
+ The width of `(T, \beta)` is defined as `max\{|\beta (t)|-1: t \in V(T) \}`.
24
+ The treewidth of G is defined as the minimum width over all tree decompositions
25
+ of `G`.
26
+
27
+ **Some known results** :
28
+
29
+ - Trees have treewidth 1
30
+
31
+ - Cycles have treewidth 2
32
+
33
+ - Series-parallel graphs have treewidth at most 2
34
+
35
+ - Cliques must be contained in some bag of a tree decomposition
36
+
37
+ Computing the treewidth or a tree decomposition of a given graph is NP-hard in
38
+ general.
39
+
40
+ **This module contains the following functions** :
41
+
42
+ .. csv-table::
43
+ :class: contentstable
44
+ :widths: 30, 70
45
+ :delim: |
46
+
47
+ :meth:`treedecomposition_exact` | Compute a tree decomposition of exact width
48
+ :meth:`get_width` | Return the width of a given tree decomposition
49
+
50
+
51
+ AUTHOR: Lukas Larisch (10-25-2015): Initial version
52
+
53
+ REFERENCE:
54
+
55
+ - [ST1993]_
56
+
57
+ - [AP1986]_
58
+
59
+ - [Bod1993]_
60
+
61
+ Methods
62
+ -------
63
+ """
64
+
65
+ from libcpp.vector cimport vector
66
+ from cysignals.signals cimport sig_on, sig_off
67
+
68
+ from sage.sets.set import Set
69
+ from sage.graphs.graph import Graph
70
+
71
+ cdef extern from "sage_tdlib.cpp":
72
+ int sage_exact_decomposition(vector[unsigned int] &V_G, vector[unsigned int] &E_G, vector[vector[int]] &V_T, vector[unsigned int] &E_T, int lb)
73
+
74
+
75
+ ##############################################################
76
+ # ########## GRAPH/DECOMPOSITION ENCODING/DECODING ###########
77
+ # the following will be used implicitly to do the translation
78
+ # between Sage graph encoding and BGL graph encoding.
79
+
80
+ cdef make_tdlib_graph(G, vertex_to_int, vector[unsigned int] &V, vector[unsigned int] &E) noexcept:
81
+ for i in range(G.order()):
82
+ V.push_back(i)
83
+
84
+ for u, v in G.edge_iterator(labels=False):
85
+ E.push_back(vertex_to_int[u])
86
+ E.push_back(vertex_to_int[v])
87
+
88
+
89
+ cdef make_sage_decomp(G, vector[vector[int]] &V, vector[unsigned int] &E, int_to_vertex) noexcept:
90
+ cdef int i, j
91
+ for i in range(len(V)):
92
+ G.add_vertex(Set([int_to_vertex[j] for j in V[i]]))
93
+
94
+ for i in range(0, len(E), 2):
95
+ G.add_edge(Set([int_to_vertex[j] for j in V[E[i]]]), Set([int_to_vertex[j] for j in V[E[i+1]]]))
96
+
97
+
98
+ ##############################################################
99
+ # ########## EXACT ALGORITHMS ################################
100
+
101
+ def treedecomposition_exact(G, lb=-1):
102
+ r"""
103
+ Compute a tree decomposition of exact width.
104
+
105
+ The returned tree decomposition is exact iff the given lower bound is not
106
+ greater than the treewidth of the input graph. Otherwise a tree
107
+ decomposition of a width than matches the given lower bound will be
108
+ computed.
109
+
110
+ INPUT:
111
+
112
+ - ``G`` -- a generic graph
113
+
114
+ - ``lb`` -- integer (default: -1); a lower bound to the treewidth of G,
115
+ e.g. computed by lower_bound
116
+
117
+ OUTPUT:
118
+
119
+ A tree decomposition of ``G`` of ``tw(G)``, if the lower bound was not
120
+ greater than ``tw(G)``, otherwise a tree decomposition of ``width = lb``.
121
+
122
+ .. WARNING::
123
+
124
+ The computation can take a lot of time for a graph `G` on more than
125
+ about 30 vertices and `tw(G) > 3`.
126
+
127
+ EXAMPLES::
128
+
129
+ sage: # optional - tdlib
130
+ sage: import sage.graphs.graph_decompositions.tdlib as tdlib
131
+ sage: G = graphs.HouseGraph()
132
+ sage: T = tdlib.treedecomposition_exact(G)
133
+ sage: T.show(vertex_size=2000) # needs sage.plot
134
+
135
+ TESTS::
136
+
137
+ sage: # optional - tdlib
138
+ sage: import sage.graphs.graph_decompositions.tdlib as tdlib
139
+ sage: G = graphs.HouseGraph()
140
+ sage: T = tdlib.treedecomposition_exact(G)
141
+ sage: G = graphs.PetersenGraph()
142
+ sage: T = tdlib.treedecomposition_exact(G)
143
+ """
144
+ cdef vector[unsigned int] V_G, E_G, E_T
145
+ cdef vector[vector[int]] V_T
146
+
147
+ cdef list int_to_vertex = list(G)
148
+ cdef dict vertex_to_int = {v: i for i, v in enumerate(G)}
149
+
150
+ make_tdlib_graph(G, vertex_to_int, V_G, E_G)
151
+
152
+ cdef int c_lb = lb
153
+
154
+ sig_on()
155
+ sage_exact_decomposition(V_G, E_G, V_T, E_T, c_lb)
156
+ sig_off()
157
+
158
+ T = Graph(name="Tree decomposition")
159
+ make_sage_decomp(T, V_T, E_T, int_to_vertex)
160
+
161
+ return T
162
+
163
+
164
+ def get_width(T):
165
+ """
166
+ Return the width of a given tree decomposition.
167
+
168
+ The width of a tree decompositions is the maximal size of a bag minus one.
169
+
170
+ INPUT:
171
+
172
+ - ``T`` -- a tree decomposition
173
+
174
+ OUTPUT: the width of ``T``
175
+
176
+ EXAMPLES::
177
+
178
+ sage: # optional - tdlib
179
+ sage: import sage.graphs.graph_decompositions.tdlib as tdlib
180
+ sage: G = graphs.PetersenGraph()
181
+ sage: T = tdlib.treedecomposition_exact(G)
182
+ sage: tdlib.get_width(T)
183
+ 4
184
+ """
185
+ return (max(len(x) for x in T) - 1) if T else -1