passagemath-planarity 10.6.33__cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.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,114 @@
1
+ Metadata-Version: 2.4
2
+ Name: passagemath-planarity
3
+ Version: 10.6.33
4
+ Summary: passagemath: Graph planarity with the edge addition planarity suite
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
+ Requires-Dist: passagemath-graphs
33
+ Provides-Extra: test
34
+ Requires-Dist: passagemath-repl; extra == "test"
35
+
36
+ ========================================================================
37
+ passagemath: Graph planarity with the edge addition planarity suite
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-planarity`` is a small
89
+ optional distribution for use with ``passagemath-graphs``.
90
+
91
+ It provides a Cython interface to the
92
+ `Edge Addition Planarity Suite <https://github.com/graph-algorithms/edge-addition-planarity-suite/>`_
93
+ by John Boyer.
94
+
95
+
96
+ What is included
97
+ ----------------
98
+
99
+ - `Cython interface to Boyer's planarity algorithm <https://passagemath.org/docs/latest/html/en/reference/graphs/sage/graphs/planarity.html>`_
100
+
101
+
102
+ Examples
103
+ --------
104
+
105
+ ::
106
+
107
+ $ pipx run --pip-args="--prefer-binary" --spec "passagemath-planarity[test]" ipython
108
+
109
+ In [1]: from sage.all__sagemath_planarity import *
110
+
111
+ In [2]: g = graphs.PetersenGraph()
112
+
113
+ In [3]: g.is_planar()
114
+ Out[3]: False
@@ -0,0 +1,9 @@
1
+ passagemath_planarity.libs/libplanarity-1caa02de.so.2.0.0,sha256=oxHNikQFcCJ1vwUwACrGFXmPTsS6nqfwS7h9ZyWBrcw,797409
2
+ sage/all__sagemath_planarity.py,sha256=dECwfNACjxwWI9PD5V5iC7MyTSIFTCHmJxryPSf2Cqw,109
3
+ sage/graphs/all__sagemath_planarity.py,sha256=CYZamBzI163p8V2TX9c1rV2S9cGAOxEOhc82QQkpTvQ,48
4
+ sage/graphs/planarity.cpython-314t-aarch64-linux-gnu.so,sha256=hluBKwLjAL3SgeIhrs0GBahyDeLhQHVqwkUGL9L4A2k,856945
5
+ sage/graphs/planarity.pyx,sha256=2OQXReYJKYQ6MjVMO0uAj3I-z_X7fN4nau1aCfe_EUU,7093
6
+ passagemath_planarity-10.6.33.dist-info/METADATA,sha256=jbLLxi-j02xMeppOgAnEkMYlnH8_RSIRkOZA0GMoLQo,4859
7
+ passagemath_planarity-10.6.33.dist-info/WHEEL,sha256=Klc695QJfkUQN6ZiWyj9Y_w-eR82-M5d6Qzo8oOOF4Q,196
8
+ passagemath_planarity-10.6.33.dist-info/top_level.txt,sha256=Kmzulf9WsphADFQuqgvdy5mvTLDj_V2zkFHU2s3UXos,6
9
+ passagemath_planarity-10.6.33.dist-info/RECORD,,
@@ -0,0 +1,7 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp314-cp314t-manylinux_2_17_aarch64
5
+ Tag: cp314-cp314t-manylinux2014_aarch64
6
+ Tag: cp314-cp314t-manylinux_2_28_aarch64
7
+
@@ -0,0 +1,4 @@
1
+ # sage_setup: distribution = sagemath-planarity
2
+ # delvewheel: patch
3
+
4
+ from sage.all__sagemath_graphs import *
@@ -0,0 +1 @@
1
+ # sage_setup: distribution = sagemath-planarity
@@ -0,0 +1,191 @@
1
+ # sage_setup: distribution = sagemath-planarity
2
+ # distutils: libraries = planarity
3
+ """
4
+ Wrapper for Boyer's (C) planarity algorithm
5
+ """
6
+
7
+ cdef extern from "planarity/graph.h":
8
+ ctypedef struct vertexRec:
9
+ int link[2]
10
+ int index
11
+ ctypedef vertexRec * vertexRecP
12
+
13
+ ctypedef struct edgeRec:
14
+ int link[2]
15
+ int neighbor
16
+ ctypedef edgeRec * edgeRecP
17
+
18
+ ctypedef struct BM_graph:
19
+ vertexRecP V
20
+ edgeRecP E
21
+ int N
22
+ ctypedef BM_graph * graphP
23
+
24
+ cdef int OK, EMBEDFLAGS_PLANAR, NONEMBEDDABLE, NOTOK
25
+
26
+ cdef graphP gp_New()
27
+ cdef void gp_Free(graphP *pGraph)
28
+ cdef int gp_InitGraph(graphP theGraph, int N)
29
+ cdef int gp_AddEdge(graphP theGraph, int u, int ulink, int v, int vlink)
30
+ cdef int gp_Embed(graphP theGraph, int embedFlags)
31
+ cdef int gp_SortVertices(graphP theGraph)
32
+
33
+
34
+ def is_planar(g, kuratowski=False, set_pos=False, set_embedding=False):
35
+ r"""
36
+ Check whether ``g`` is planar using Boyer's planarity algorithm.
37
+
38
+ If ``kuratowski`` is ``False``, returns ``True`` if ``g`` is planar,
39
+ ``False`` otherwise. If ``kuratowski`` is ``True``, returns a tuple, first
40
+ entry is a boolean (whether or not the graph is planar) and second entry is
41
+ a Kuratowski subgraph, i.e. an edge subdivision of `K_5` or `K_{3,3}` (if
42
+ not planar) or ``None`` (if planar). Also, will set an ``_embedding``
43
+ attribute for the graph ``g`` if ``set_embedding`` is set to ``True``.
44
+
45
+ INPUT:
46
+
47
+ - ``kuratowski`` -- boolean (default: ``False``); when set to ``True``,
48
+ return a tuple of a boolean and either ``None`` or a Kuratowski subgraph
49
+ (i.e. an edge subdivision of `K_5` or `K_{3,3}`). When set to ``False``,
50
+ returns ``True`` if ``g`` is planar, ``False`` otherwise.
51
+
52
+ - ``set_pos`` -- boolean (default: ``False``); whether to use Schnyder's
53
+ algorithm to determine and set positions
54
+
55
+ - ``set_embedding`` -- boolean (default: ``False``); whether to record the
56
+ combinatorial embedding returned (see
57
+ :meth:`~sage.graphs.generic_graph.GenericGraph.get_embedding`)
58
+
59
+ EXAMPLES::
60
+
61
+ sage: G = graphs.DodecahedralGraph()
62
+ sage: from sage.graphs.planarity import is_planar
63
+ sage: is_planar(G)
64
+ True
65
+ sage: Graph('@').is_planar()
66
+ True
67
+
68
+ TESTS:
69
+
70
+ We try checking the planarity of all graphs on 7 or fewer
71
+ vertices. In fact, to try to track down a segfault, we do it
72
+ twice. ::
73
+
74
+ sage: # long time, needs networkx
75
+ sage: import networkx.generators.atlas
76
+ sage: atlas_graphs = [Graph(i) for i in networkx.generators.atlas.graph_atlas_g()]
77
+ sage: a = [i for i in [1..1252] if atlas_graphs[i].is_planar()]
78
+ sage: b = [i for i in [1..1252] if atlas_graphs[i].is_planar()]
79
+ sage: a == b
80
+ True
81
+
82
+ There were some problems with ``set_pos`` stability in the past,
83
+ so let's check if this runs without exception::
84
+
85
+ sage: for i, g in enumerate(atlas_graphs): # long time # needs networkx
86
+ ....: if (not g.is_connected() or i == 0):
87
+ ....: continue
88
+ ....: _ = g.is_planar(set_embedding=True, set_pos=True)
89
+
90
+ Argument saving::
91
+
92
+ sage: G = Graph([(1, 2)])
93
+ sage: for set_embedding, set_pos in ((True,True), (True,False), (False, True), (False, False)):
94
+ ....: G = Graph([(1, 2)])
95
+ ....: assert is_planar(G, set_embedding=set_embedding, set_pos=set_pos)
96
+ ....: assert (hasattr(G, '_embedding') and G._embedding is not None) == set_embedding, (set_embedding, set_pos)
97
+ ....: assert (hasattr(G, '_pos') and G._pos is not None) == set_pos, (set_embedding, set_pos)
98
+ """
99
+ g._scream_if_not_simple()
100
+ if set_pos and not g.is_connected():
101
+ raise ValueError("is_planar() cannot set vertex positions for a disconnected graph")
102
+
103
+ # First take care of a trivial cases
104
+ if not g.size():
105
+ # There are no edges
106
+ if set_embedding:
107
+ g._embedding = {v: [] for v in g}
108
+ return (True, None) if kuratowski else True
109
+ if g.order() == 2 and g.is_connected():
110
+ # P_2 is too small to be triangulated
111
+ u, v = list(g)
112
+ if set_embedding:
113
+ g._embedding = {u: [v], v: [u]}
114
+ if set_pos:
115
+ g._pos = {u: [0, 0], v: [0, 1]}
116
+ return (True, None) if kuratowski else True
117
+
118
+ # Create to and from mappings to relabel vertices to the set {1,...,n}
119
+ # (planarity 3 uses 1-based array indexing, with 0 representing NIL)
120
+ cdef int i
121
+ cdef list listto = list(g)
122
+ cdef dict ffrom = {vvv: i for i, vvv in enumerate(listto, start=1)}
123
+ cdef dict to = {i: vvv for i, vvv in enumerate(listto, start=1)}
124
+
125
+ cdef graphP theGraph
126
+ theGraph = gp_New()
127
+ cdef int status
128
+ status = gp_InitGraph(theGraph, g.order())
129
+ if status != OK:
130
+ raise RuntimeError("gp_InitGraph status is not ok")
131
+ for u, v in g.edge_iterator(labels=False):
132
+ status = gp_AddEdge(theGraph, ffrom[u], 0, ffrom[v], 0)
133
+ if status == NOTOK:
134
+ raise RuntimeError("gp_AddEdge status is not ok")
135
+ elif status == NONEMBEDDABLE:
136
+ # We now know that the graph is nonplanar.
137
+ if not kuratowski:
138
+ gp_Free(&theGraph)
139
+ return False
140
+ # With just the current edges, we have a nonplanar graph,
141
+ # so to isolate a kuratowski subgraph, just keep going.
142
+ break
143
+
144
+ status = gp_Embed(theGraph, EMBEDFLAGS_PLANAR)
145
+
146
+ if status == NOTOK:
147
+ raise RuntimeError("status is not ok")
148
+
149
+ gp_SortVertices(theGraph)
150
+
151
+ if status == NONEMBEDDABLE:
152
+ # Kuratowski subgraph isolator
153
+ if not kuratowski:
154
+ gp_Free(&theGraph)
155
+ return False
156
+ g_dict = {}
157
+ for i in range(1, theGraph.N + 1):
158
+ linked_list = []
159
+ j = theGraph.V[i].link[1]
160
+ while j:
161
+ linked_list.append(to[theGraph.E[j].neighbor])
162
+ j = theGraph.E[j].link[1]
163
+ if linked_list:
164
+ g_dict[to[i]] = linked_list
165
+ gp_Free(&theGraph)
166
+ G = g.__class__(data=g_dict, weighted=g._weighted,
167
+ loops=g.allows_loops(),
168
+ multiedges=g.allows_multiple_edges(),
169
+ name="Kuratowski subgraph of (%s)" % g.name())
170
+ if g.get_pos():
171
+ G.set_pos({u: g._pos[u] for u in g_dict})
172
+ return (False, G)
173
+
174
+ if set_pos or set_embedding:
175
+ emb_dict = {}
176
+ for i in range(1, theGraph.N + 1):
177
+ linked_list = []
178
+ j = theGraph.V[i].link[1]
179
+ while j:
180
+ linked_list.append(to[theGraph.E[j].neighbor])
181
+ j = theGraph.E[j].link[1]
182
+ emb_dict[to[i]] = linked_list
183
+ if set_embedding:
184
+ g._embedding = emb_dict
185
+ if set_pos:
186
+ g.layout(layout='planar', save_pos=True, on_embedding=emb_dict)
187
+
188
+ gp_Free(&theGraph)
189
+ if kuratowski:
190
+ return (True, None)
191
+ return True