passagemath-graphs 10.6.1rc1__cp310-cp310-musllinux_1_2_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.
- passagemath_graphs-10.6.1rc1.dist-info/METADATA +292 -0
- passagemath_graphs-10.6.1rc1.dist-info/RECORD +260 -0
- passagemath_graphs-10.6.1rc1.dist-info/WHEEL +5 -0
- passagemath_graphs-10.6.1rc1.dist-info/top_level.txt +2 -0
- passagemath_graphs.libs/libgcc_s-69c45f16.so.1 +0 -0
- passagemath_graphs.libs/libgmp-8e78bd9b.so.10.5.0 +0 -0
- passagemath_graphs.libs/libstdc++-1f1a71be.so.6.0.33 +0 -0
- sage/all__sagemath_graphs.py +39 -0
- sage/combinat/abstract_tree.py +2723 -0
- sage/combinat/all__sagemath_graphs.py +34 -0
- sage/combinat/binary_tree.py +5306 -0
- sage/combinat/cluster_algebra_quiver/all.py +22 -0
- sage/combinat/cluster_algebra_quiver/cluster_seed.py +5208 -0
- sage/combinat/cluster_algebra_quiver/interact.py +124 -0
- sage/combinat/cluster_algebra_quiver/mutation_class.py +625 -0
- sage/combinat/cluster_algebra_quiver/mutation_type.py +1555 -0
- sage/combinat/cluster_algebra_quiver/quiver.py +2290 -0
- sage/combinat/cluster_algebra_quiver/quiver_mutation_type.py +2468 -0
- sage/combinat/designs/MOLS_handbook_data.py +570 -0
- sage/combinat/designs/all.py +58 -0
- sage/combinat/designs/bibd.py +1655 -0
- sage/combinat/designs/block_design.py +1071 -0
- sage/combinat/designs/covering_array.py +269 -0
- sage/combinat/designs/covering_design.py +530 -0
- sage/combinat/designs/database.py +5615 -0
- sage/combinat/designs/design_catalog.py +122 -0
- sage/combinat/designs/designs_pyx.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/designs/designs_pyx.pxd +21 -0
- sage/combinat/designs/designs_pyx.pyx +993 -0
- sage/combinat/designs/difference_family.py +3951 -0
- sage/combinat/designs/difference_matrices.py +279 -0
- sage/combinat/designs/evenly_distributed_sets.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/designs/evenly_distributed_sets.pyx +661 -0
- sage/combinat/designs/ext_rep.py +1064 -0
- sage/combinat/designs/gen_quadrangles_with_spread.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/designs/gen_quadrangles_with_spread.pyx +339 -0
- sage/combinat/designs/group_divisible_designs.py +361 -0
- sage/combinat/designs/incidence_structures.py +2357 -0
- sage/combinat/designs/latin_squares.py +581 -0
- sage/combinat/designs/orthogonal_arrays.py +2244 -0
- sage/combinat/designs/orthogonal_arrays_build_recursive.py +1780 -0
- sage/combinat/designs/orthogonal_arrays_find_recursive.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/designs/orthogonal_arrays_find_recursive.pyx +967 -0
- sage/combinat/designs/resolvable_bibd.py +815 -0
- sage/combinat/designs/steiner_quadruple_systems.py +1306 -0
- sage/combinat/designs/subhypergraph_search.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/designs/subhypergraph_search.pyx +530 -0
- sage/combinat/designs/twographs.py +306 -0
- sage/combinat/finite_state_machine.py +14874 -0
- sage/combinat/finite_state_machine_generators.py +2006 -0
- sage/combinat/graph_path.py +448 -0
- sage/combinat/interval_posets.py +3908 -0
- sage/combinat/nu_tamari_lattice.py +269 -0
- sage/combinat/ordered_tree.py +1446 -0
- sage/combinat/posets/all.py +46 -0
- sage/combinat/posets/bubble_shuffle.py +247 -0
- sage/combinat/posets/cartesian_product.py +493 -0
- sage/combinat/posets/d_complete.py +182 -0
- sage/combinat/posets/elements.py +273 -0
- sage/combinat/posets/forest.py +30 -0
- sage/combinat/posets/hasse_cython.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/posets/hasse_cython.pyx +174 -0
- sage/combinat/posets/hasse_diagram.py +3672 -0
- sage/combinat/posets/hochschild_lattice.py +158 -0
- sage/combinat/posets/incidence_algebras.py +794 -0
- sage/combinat/posets/lattices.py +5117 -0
- sage/combinat/posets/linear_extension_iterator.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/posets/linear_extension_iterator.pyx +292 -0
- sage/combinat/posets/linear_extensions.py +1037 -0
- sage/combinat/posets/mobile.py +275 -0
- sage/combinat/posets/moebius_algebra.py +776 -0
- sage/combinat/posets/poset_examples.py +2178 -0
- sage/combinat/posets/posets.py +9360 -0
- sage/combinat/rooted_tree.py +1070 -0
- sage/combinat/shard_order.py +239 -0
- sage/combinat/tamari_lattices.py +384 -0
- sage/combinat/yang_baxter_graph.py +923 -0
- sage/databases/all__sagemath_graphs.py +1 -0
- sage/databases/knotinfo_db.py +1231 -0
- sage/ext_data/all__sagemath_graphs.py +1 -0
- sage/ext_data/graphs/graph_plot_js.html +330 -0
- sage/ext_data/kenzo/CP2.txt +45 -0
- sage/ext_data/kenzo/CP3.txt +349 -0
- sage/ext_data/kenzo/CP4.txt +4774 -0
- sage/ext_data/kenzo/README.txt +49 -0
- sage/ext_data/kenzo/S4.txt +20 -0
- sage/graphs/all.py +42 -0
- sage/graphs/asteroidal_triples.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/asteroidal_triples.pyx +320 -0
- sage/graphs/base/all.py +1 -0
- sage/graphs/base/boost_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/boost_graph.pxd +106 -0
- sage/graphs/base/boost_graph.pyx +3045 -0
- sage/graphs/base/c_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/c_graph.pxd +106 -0
- sage/graphs/base/c_graph.pyx +5096 -0
- sage/graphs/base/dense_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/dense_graph.pxd +28 -0
- sage/graphs/base/dense_graph.pyx +801 -0
- sage/graphs/base/graph_backends.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/graph_backends.pxd +5 -0
- sage/graphs/base/graph_backends.pyx +797 -0
- sage/graphs/base/overview.py +85 -0
- sage/graphs/base/sparse_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/sparse_graph.pxd +90 -0
- sage/graphs/base/sparse_graph.pyx +1653 -0
- sage/graphs/base/static_dense_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/static_dense_graph.pxd +5 -0
- sage/graphs/base/static_dense_graph.pyx +1032 -0
- sage/graphs/base/static_sparse_backend.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/static_sparse_backend.pxd +27 -0
- sage/graphs/base/static_sparse_backend.pyx +1583 -0
- sage/graphs/base/static_sparse_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/static_sparse_graph.pxd +37 -0
- sage/graphs/base/static_sparse_graph.pyx +1375 -0
- sage/graphs/bipartite_graph.py +2732 -0
- sage/graphs/centrality.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/centrality.pyx +1038 -0
- sage/graphs/cographs.py +519 -0
- sage/graphs/comparability.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/comparability.pyx +851 -0
- sage/graphs/connectivity.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/connectivity.pxd +157 -0
- sage/graphs/connectivity.pyx +4813 -0
- sage/graphs/convexity_properties.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/convexity_properties.pxd +16 -0
- sage/graphs/convexity_properties.pyx +870 -0
- sage/graphs/digraph.py +4754 -0
- sage/graphs/digraph_generators.py +1993 -0
- sage/graphs/distances_all_pairs.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/distances_all_pairs.pxd +12 -0
- sage/graphs/distances_all_pairs.pyx +2938 -0
- sage/graphs/domination.py +1363 -0
- sage/graphs/dot2tex_utils.py +100 -0
- sage/graphs/edge_connectivity.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/edge_connectivity.pyx +1215 -0
- sage/graphs/generators/all.py +1 -0
- sage/graphs/generators/basic.py +1769 -0
- sage/graphs/generators/chessboard.py +538 -0
- sage/graphs/generators/classical_geometries.py +1611 -0
- sage/graphs/generators/degree_sequence.py +235 -0
- sage/graphs/generators/distance_regular.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/generators/distance_regular.pyx +2846 -0
- sage/graphs/generators/families.py +4759 -0
- sage/graphs/generators/intersection.py +565 -0
- sage/graphs/generators/platonic_solids.py +262 -0
- sage/graphs/generators/random.py +2623 -0
- sage/graphs/generators/smallgraphs.py +5741 -0
- sage/graphs/generators/world_map.py +724 -0
- sage/graphs/generic_graph.py +26867 -0
- sage/graphs/generic_graph_pyx.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/generic_graph_pyx.pxd +34 -0
- sage/graphs/generic_graph_pyx.pyx +1673 -0
- sage/graphs/genus.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/genus.pyx +622 -0
- sage/graphs/graph.py +9645 -0
- sage/graphs/graph_coloring.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_coloring.pyx +2284 -0
- sage/graphs/graph_database.py +1177 -0
- sage/graphs/graph_decompositions/all.py +1 -0
- sage/graphs/graph_decompositions/bandwidth.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/bandwidth.pyx +428 -0
- sage/graphs/graph_decompositions/clique_separators.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/clique_separators.pyx +616 -0
- sage/graphs/graph_decompositions/cutwidth.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/cutwidth.pyx +753 -0
- sage/graphs/graph_decompositions/fast_digraph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/fast_digraph.pxd +13 -0
- sage/graphs/graph_decompositions/fast_digraph.pyx +212 -0
- sage/graphs/graph_decompositions/graph_products.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/graph_products.pyx +508 -0
- sage/graphs/graph_decompositions/modular_decomposition.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/modular_decomposition.pxd +27 -0
- sage/graphs/graph_decompositions/modular_decomposition.pyx +1536 -0
- sage/graphs/graph_decompositions/slice_decomposition.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/slice_decomposition.pxd +18 -0
- sage/graphs/graph_decompositions/slice_decomposition.pyx +1106 -0
- sage/graphs/graph_decompositions/tree_decomposition.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/tree_decomposition.pxd +17 -0
- sage/graphs/graph_decompositions/tree_decomposition.pyx +1996 -0
- sage/graphs/graph_decompositions/vertex_separation.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/vertex_separation.pxd +5 -0
- sage/graphs/graph_decompositions/vertex_separation.pyx +1963 -0
- sage/graphs/graph_editor.py +82 -0
- sage/graphs/graph_generators.py +3314 -0
- sage/graphs/graph_generators_pyx.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_generators_pyx.pyx +95 -0
- sage/graphs/graph_input.py +812 -0
- sage/graphs/graph_latex.py +2064 -0
- sage/graphs/graph_list.py +410 -0
- sage/graphs/graph_plot.py +1756 -0
- sage/graphs/graph_plot_js.py +338 -0
- sage/graphs/hyperbolicity.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/hyperbolicity.pyx +1704 -0
- sage/graphs/hypergraph_generators.py +364 -0
- sage/graphs/independent_sets.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/independent_sets.pxd +13 -0
- sage/graphs/independent_sets.pyx +402 -0
- sage/graphs/isgci.py +1033 -0
- sage/graphs/isoperimetric_inequalities.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/isoperimetric_inequalities.pyx +489 -0
- sage/graphs/line_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/line_graph.pyx +743 -0
- sage/graphs/lovasz_theta.py +77 -0
- sage/graphs/matching.py +1633 -0
- sage/graphs/matching_covered_graph.py +3590 -0
- sage/graphs/orientations.py +1489 -0
- sage/graphs/partial_cube.py +459 -0
- sage/graphs/path_enumeration.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/path_enumeration.pyx +2040 -0
- sage/graphs/pq_trees.py +1129 -0
- sage/graphs/print_graphs.py +201 -0
- sage/graphs/schnyder.py +865 -0
- sage/graphs/spanning_tree.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/spanning_tree.pyx +1457 -0
- sage/graphs/strongly_regular_db.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/strongly_regular_db.pyx +3340 -0
- sage/graphs/traversals.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/traversals.pxd +9 -0
- sage/graphs/traversals.pyx +1872 -0
- sage/graphs/trees.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/trees.pxd +15 -0
- sage/graphs/trees.pyx +310 -0
- sage/graphs/tutte_polynomial.py +713 -0
- sage/graphs/views.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/views.pyx +794 -0
- sage/graphs/weakly_chordal.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/weakly_chordal.pyx +604 -0
- sage/groups/all__sagemath_graphs.py +1 -0
- sage/groups/perm_gps/all__sagemath_graphs.py +1 -0
- sage/groups/perm_gps/partn_ref/all__sagemath_graphs.py +1 -0
- sage/groups/perm_gps/partn_ref/refinement_graphs.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_graphs.pxd +38 -0
- sage/groups/perm_gps/partn_ref/refinement_graphs.pyx +1666 -0
- sage/knots/all.py +6 -0
- sage/knots/free_knotinfo_monoid.py +507 -0
- sage/knots/gauss_code.py +291 -0
- sage/knots/knot.py +682 -0
- sage/knots/knot_table.py +284 -0
- sage/knots/knotinfo.py +2900 -0
- sage/knots/link.py +4715 -0
- sage/sandpiles/all.py +13 -0
- sage/sandpiles/examples.py +225 -0
- sage/sandpiles/sandpile.py +6365 -0
- sage/topology/all.py +22 -0
- sage/topology/cell_complex.py +1214 -0
- sage/topology/cubical_complex.py +1976 -0
- sage/topology/delta_complex.py +1806 -0
- sage/topology/filtered_simplicial_complex.py +744 -0
- sage/topology/moment_angle_complex.py +823 -0
- sage/topology/simplicial_complex.py +5160 -0
- sage/topology/simplicial_complex_catalog.py +92 -0
- sage/topology/simplicial_complex_examples.py +1680 -0
- sage/topology/simplicial_complex_homset.py +205 -0
- sage/topology/simplicial_complex_morphism.py +836 -0
- sage/topology/simplicial_set.py +4102 -0
- sage/topology/simplicial_set_catalog.py +55 -0
- sage/topology/simplicial_set_constructions.py +2954 -0
- sage/topology/simplicial_set_examples.py +865 -0
- sage/topology/simplicial_set_morphism.py +1464 -0
@@ -0,0 +1,49 @@
|
|
1
|
+
These files contain code for producing simplicial set structures for spaces homotopy equivalent to n-dimensional complex projective space, using the algorithm described in "Triangulations of complex projective spaces" by Sergeraert. The f-vectors for these models for CP^n:
|
2
|
+
|
3
|
+
n=2: 1 0 2 3 3
|
4
|
+
n=3: 1 0 3 10 25 30 15
|
5
|
+
n=4: 1 0 4 22 97 255 390 315 105
|
6
|
+
n=5: 1 0 5 40 271 1197 3381 5975 6405 3780 945
|
7
|
+
n=6: 1 0 6 65 627 4162 18496 54789 107933 139230 112770 51975 10395
|
8
|
+
|
9
|
+
Kenzo:
|
10
|
+
- https://www-fourier.ujf-grenoble.fr/~sergerar/Kenzo/
|
11
|
+
- https://github.com/gheber/kenzo
|
12
|
+
|
13
|
+
The results for CP^2, CP^3, and CP^4 have been saved in the corresponding text files. The file S4.txt includes the 4-sphere, just for testing purposes. These files can be processed by the function "simplicial_data_from_kenzo_output" in sage/topology/simplicial_set.py. To get a simplicial set structure for CP^n using Kenzo in sbcl, do the following.
|
14
|
+
|
15
|
+
;;
|
16
|
+
;; Start Kenzo.
|
17
|
+
;;
|
18
|
+
(require :asdf)
|
19
|
+
(require :kenzo)
|
20
|
+
(in-package "CAT")
|
21
|
+
;;
|
22
|
+
;; Define K(Z,2).
|
23
|
+
;;
|
24
|
+
(setf kz2 (k-z 2))
|
25
|
+
;;
|
26
|
+
;; Define effective homology version of K(Z,2).
|
27
|
+
;;
|
28
|
+
(setf efhm-kz2 (efhm kz2))
|
29
|
+
;;
|
30
|
+
;; The previous command produces output of the form
|
31
|
+
;; [K153 Homotopy-Equivalence K13 <= K143 => K139]
|
32
|
+
;;
|
33
|
+
;; In the following, replace "139" with the right-hand number.
|
34
|
+
;; Replace "4" with the desired dimension: 2n if you're constructing
|
35
|
+
;; CP^n.
|
36
|
+
;;
|
37
|
+
;; That is, the point is to find the smallest subcomplex of K(Z,2)
|
38
|
+
;; which contains the given homology class. If you replace "4" with
|
39
|
+
;; "2n", this should give a complex homotopy equivalent to CP^n.
|
40
|
+
;;
|
41
|
+
(chcm-homology-gen (k 139) 4)
|
42
|
+
(setf g (first *))
|
43
|
+
(setf z4 (lf efhm-kz2 (rg efhm-kz2 g)))
|
44
|
+
(multiple-value-setq (ssz4 incl) (gmsms-subsmst kz2 z4))
|
45
|
+
;;
|
46
|
+
;; Now ssz4 is a model for the 4-dimensional complex CP^2, so display
|
47
|
+
;; its nondegenerate simplices through dimension 4.
|
48
|
+
;;
|
49
|
+
(show-structure ssz4 4)
|
@@ -0,0 +1,20 @@
|
|
1
|
+
;; The 4-sphere.
|
2
|
+
|
3
|
+
* (show-structure S4 4)
|
4
|
+
|
5
|
+
|
6
|
+
Dimension = 0:
|
7
|
+
|
8
|
+
Vertices : (*)
|
9
|
+
|
10
|
+
Dimension = 1:
|
11
|
+
|
12
|
+
Dimension = 2:
|
13
|
+
|
14
|
+
Dimension = 3:
|
15
|
+
|
16
|
+
Dimension = 4:
|
17
|
+
|
18
|
+
Simplex : S4
|
19
|
+
|
20
|
+
Faces : (<AbSm 2-1-0 *> <AbSm 2-1-0 *> <AbSm 2-1-0 *> <AbSm 2-1-0 *> <AbSm 2-1-0 *>)
|
sage/graphs/all.py
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-graphs
|
2
|
+
|
3
|
+
from sage.misc.lazy_import import lazy_import
|
4
|
+
|
5
|
+
lazy_import("sage.graphs.graph_generators", "graphs")
|
6
|
+
lazy_import("sage.graphs.digraph_generators", "digraphs")
|
7
|
+
lazy_import("sage.graphs.hypergraph_generators", "hypergraphs")
|
8
|
+
lazy_import("sage.graphs.graph_database", [
|
9
|
+
"GraphDatabase", "GenericGraphQuery", "GraphQuery"])
|
10
|
+
from sage.graphs.graph import Graph
|
11
|
+
from sage.graphs.digraph import DiGraph
|
12
|
+
from sage.graphs.bipartite_graph import BipartiteGraph
|
13
|
+
from sage.graphs.matching_covered_graph import MatchingCoveredGraph
|
14
|
+
import sage.graphs.weakly_chordal
|
15
|
+
import sage.graphs.lovasz_theta
|
16
|
+
import sage.graphs.partial_cube
|
17
|
+
from sage.graphs import graph_list as graphs_list
|
18
|
+
lazy_import("sage.graphs", "graph_coloring")
|
19
|
+
lazy_import("sage.graphs.graph_database", "graph_db_info")
|
20
|
+
lazy_import("sage.graphs.graph_editor", "graph_editor")
|
21
|
+
|
22
|
+
from sage.graphs.isgci import graph_classes
|
23
|
+
"""
|
24
|
+
TESTS:
|
25
|
+
|
26
|
+
Test that methods all_max_clique, max_clique and clique_number from
|
27
|
+
sage.graphs.cliquer are deprecated from the global namespace (:issue:`26200`)::
|
28
|
+
|
29
|
+
sage: all_max_clique(Graph())
|
30
|
+
Traceback (most recent call last):
|
31
|
+
...
|
32
|
+
NameError: name 'all_max_clique' is not defined
|
33
|
+
sage: max_clique(Graph())
|
34
|
+
Traceback (most recent call last):
|
35
|
+
...
|
36
|
+
NameError: name 'max_clique' is not defined
|
37
|
+
sage: clique_number(Graph())
|
38
|
+
Traceback (most recent call last):
|
39
|
+
...
|
40
|
+
NameError: name 'clique_number' is not defined
|
41
|
+
"""
|
42
|
+
del lazy_import
|
Binary file
|
@@ -0,0 +1,320 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-graphs
|
2
|
+
# cython: binding=True
|
3
|
+
r"""
|
4
|
+
Asteroidal triples
|
5
|
+
|
6
|
+
This module contains the following function:
|
7
|
+
|
8
|
+
.. csv-table::
|
9
|
+
:class: contentstable
|
10
|
+
:widths: 30, 70
|
11
|
+
:delim: |
|
12
|
+
|
13
|
+
:meth:`is_asteroidal_triple_free` | Test if the input graph is asteroidal triple-free
|
14
|
+
|
15
|
+
Definition
|
16
|
+
----------
|
17
|
+
|
18
|
+
Three independent vertices of a graph form an *asteroidal triple* if every two
|
19
|
+
of them are connected by a path avoiding the neighborhood of the third one. A
|
20
|
+
graph is *asteroidal triple-free* (*AT-free*, for short) if it contains no
|
21
|
+
asteroidal triple [LB1962]_.
|
22
|
+
|
23
|
+
Use ``graph_classes.AT_free.description()`` to get some known properties of
|
24
|
+
AT-free graphs, or visit `this page
|
25
|
+
<http://www.graphclasses.org/classes/gc_61.html>`_.
|
26
|
+
|
27
|
+
|
28
|
+
Algorithm
|
29
|
+
---------
|
30
|
+
|
31
|
+
This module implements the *Straightforward algorithm* recalled in [Koh2004]_ and
|
32
|
+
due to [LB1962]_ for testing if a graph is AT-free or not. This algorithm has time
|
33
|
+
complexity in `O(n^3)` and space complexity in `O(n^2)`.
|
34
|
+
|
35
|
+
This algorithm uses the *connected structure* of the graph, stored into a
|
36
|
+
`n\times n` matrix `M`. This matrix is such that `M[u][v]==0` if `v\in
|
37
|
+
(\{u\}\cup N(u))`, and otherwise `M[u][v]` is the unique identifier (a strictly
|
38
|
+
positive integer) of the connected component of `G\setminus(\{u\}\cup N(u))` to
|
39
|
+
which `v` belongs. This connected structure can be computed in time `O(n(n+m))`
|
40
|
+
using `n` BFS.
|
41
|
+
|
42
|
+
Now, a triple `u, v, w\in V` is an asteroidal triple if and only if it satisfies
|
43
|
+
`M[u][v]==M[u][w]` and `M[v][u]==M[v][w]` and `M[w][u]==M[w][v]`, assuming all
|
44
|
+
these values are positive. Indeed, if `M[u][v]==M[u][w]`, `v` and `w` are in the
|
45
|
+
same connected component of `G\setminus(\{u\}\cup N(u))`, and so there is a path
|
46
|
+
between `v` and `w` avoiding the neighborhood of `u`. The algorithm iterates
|
47
|
+
over all triples.
|
48
|
+
|
49
|
+
|
50
|
+
Functions
|
51
|
+
---------
|
52
|
+
"""
|
53
|
+
|
54
|
+
# ****************************************************************************
|
55
|
+
# Copyright (C) 2015 David Coudert <david.coudert@inria.fr>
|
56
|
+
#
|
57
|
+
# This program is free software: you can redistribute it and/or modify
|
58
|
+
# it under the terms of the GNU General Public License as published by
|
59
|
+
# the Free Software Foundation, either version 2 of the License, or
|
60
|
+
# (at your option) any later version.
|
61
|
+
# https://www.gnu.org/licenses/
|
62
|
+
# ****************************************************************************
|
63
|
+
|
64
|
+
from libc.stdint cimport uint32_t
|
65
|
+
from cysignals.signals cimport sig_on, sig_off
|
66
|
+
from memory_allocator cimport MemoryAllocator
|
67
|
+
|
68
|
+
from sage.data_structures.bitset_base cimport *
|
69
|
+
from sage.graphs.base.static_sparse_backend cimport StaticSparseCGraph
|
70
|
+
from sage.graphs.base.static_sparse_backend cimport StaticSparseBackend
|
71
|
+
from sage.graphs.base.static_sparse_graph cimport short_digraph, init_short_digraph, free_short_digraph
|
72
|
+
|
73
|
+
|
74
|
+
def is_asteroidal_triple_free(G, certificate=False):
|
75
|
+
"""
|
76
|
+
Test if the input graph is asteroidal triple-free.
|
77
|
+
|
78
|
+
An independent set of three vertices such that each pair is joined by a path
|
79
|
+
that avoids the neighborhood of the third one is called an *asteroidal
|
80
|
+
triple*. A graph is asteroidal triple-free (AT-free) if it contains no
|
81
|
+
asteroidal triples. See the :mod:`module's documentation
|
82
|
+
<sage.graphs.asteroidal_triples>` for more details.
|
83
|
+
|
84
|
+
This method returns ``True`` if the graph is AT-free and ``False`` otherwise.
|
85
|
+
|
86
|
+
INPUT:
|
87
|
+
|
88
|
+
- ``G`` -- a Graph
|
89
|
+
|
90
|
+
- ``certificate`` -- boolean (default: ``False``); by default, this method
|
91
|
+
returns ``True`` if the graph is asteroidal triple-free and ``False``
|
92
|
+
otherwise. When ``certificate==True``, this method returns in addition a
|
93
|
+
list of three vertices forming an asteroidal triple if such a triple is
|
94
|
+
found, and the empty list otherwise.
|
95
|
+
|
96
|
+
EXAMPLES:
|
97
|
+
|
98
|
+
The complete graph is AT-free, as well as its line graph::
|
99
|
+
|
100
|
+
sage: G = graphs.CompleteGraph(5)
|
101
|
+
sage: G.is_asteroidal_triple_free()
|
102
|
+
True
|
103
|
+
sage: G.is_asteroidal_triple_free(certificate=True)
|
104
|
+
(True, [])
|
105
|
+
sage: LG = G.line_graph()
|
106
|
+
sage: LG.is_asteroidal_triple_free()
|
107
|
+
True
|
108
|
+
sage: LLG = LG.line_graph()
|
109
|
+
sage: LLG.is_asteroidal_triple_free()
|
110
|
+
False
|
111
|
+
|
112
|
+
The PetersenGraph is not AT-free::
|
113
|
+
|
114
|
+
sage: from sage.graphs.asteroidal_triples import *
|
115
|
+
sage: G = graphs.PetersenGraph()
|
116
|
+
sage: G.is_asteroidal_triple_free()
|
117
|
+
False
|
118
|
+
sage: G.is_asteroidal_triple_free(certificate=True)
|
119
|
+
(False, [0, 2, 6])
|
120
|
+
|
121
|
+
TESTS:
|
122
|
+
|
123
|
+
Giving anything else than a Graph::
|
124
|
+
|
125
|
+
sage: from sage.graphs.asteroidal_triples import is_asteroidal_triple_free
|
126
|
+
sage: is_asteroidal_triple_free(DiGraph())
|
127
|
+
Traceback (most recent call last):
|
128
|
+
...
|
129
|
+
ValueError: The first parameter must be a Graph.
|
130
|
+
|
131
|
+
The method is valid for immutable graphs::
|
132
|
+
|
133
|
+
sage: G = graphs.RandomGNP(10, .7)
|
134
|
+
sage: G._backend
|
135
|
+
<sage.graphs.base.sparse_graph.SparseGraphBackend ...>
|
136
|
+
sage: H = Graph(G, immutable=True)
|
137
|
+
sage: H._backend
|
138
|
+
<sage.graphs.base.static_sparse_backend.StaticSparseBackend ...>
|
139
|
+
sage: G.is_asteroidal_triple_free() == H.is_asteroidal_triple_free()
|
140
|
+
True
|
141
|
+
"""
|
142
|
+
from sage.graphs.graph import Graph
|
143
|
+
if not isinstance(G, Graph):
|
144
|
+
raise ValueError("The first parameter must be a Graph.")
|
145
|
+
|
146
|
+
cdef uint32_t n = <uint32_t>G.order()
|
147
|
+
cdef int i
|
148
|
+
|
149
|
+
# ==> Trivial cases
|
150
|
+
if n < 3:
|
151
|
+
return (True, []) if certificate else True
|
152
|
+
|
153
|
+
# ==> Initialize some data structures for is_asteroidal_triple_free_C
|
154
|
+
cdef MemoryAllocator mem = MemoryAllocator()
|
155
|
+
cdef uint32_t* waiting_list = <uint32_t*> mem.allocarray(n, sizeof(uint32_t))
|
156
|
+
cdef uint32_t* _connected_structure = <uint32_t*> mem.calloc(n * n, sizeof(uint32_t))
|
157
|
+
cdef uint32_t** connected_structure = <uint32_t**> mem.allocarray(n, sizeof(uint32_t*))
|
158
|
+
|
159
|
+
# Copying the whole graph to obtain the list of neighbors quicker than by
|
160
|
+
# calling out_neighbors. This data structure is well documented in the
|
161
|
+
# module sage.graphs.base.static_sparse_graph
|
162
|
+
cdef list int_to_vertex
|
163
|
+
cdef StaticSparseCGraph cg
|
164
|
+
cdef short_digraph sd
|
165
|
+
if isinstance(G, StaticSparseBackend):
|
166
|
+
cg = <StaticSparseCGraph> G._cg
|
167
|
+
sd = <short_digraph> cg.g
|
168
|
+
int_to_vertex = cg._vertex_to_labels
|
169
|
+
else:
|
170
|
+
int_to_vertex = list(G)
|
171
|
+
init_short_digraph(sd, G, edge_labelled=False, vertex_list=int_to_vertex)
|
172
|
+
|
173
|
+
cdef bitset_t seen
|
174
|
+
bitset_init(seen, n)
|
175
|
+
|
176
|
+
connected_structure[0] = _connected_structure
|
177
|
+
for i in range(n-1):
|
178
|
+
connected_structure[i+1] = connected_structure[i] + n
|
179
|
+
|
180
|
+
cdef list ret = []
|
181
|
+
|
182
|
+
# ==> call is_asteroidal_triple_free_C
|
183
|
+
|
184
|
+
try:
|
185
|
+
sig_on()
|
186
|
+
ret = is_asteroidal_triple_free_C(n, sd, connected_structure, waiting_list, seen)
|
187
|
+
sig_off()
|
188
|
+
|
189
|
+
finally:
|
190
|
+
# Release memory
|
191
|
+
bitset_free(seen)
|
192
|
+
if not isinstance(G, StaticSparseBackend):
|
193
|
+
free_short_digraph(sd)
|
194
|
+
|
195
|
+
# ==> We return the result
|
196
|
+
|
197
|
+
if certificate:
|
198
|
+
if ret:
|
199
|
+
return False, [int_to_vertex[i] for i in ret]
|
200
|
+
return True, []
|
201
|
+
|
202
|
+
return False if ret else True
|
203
|
+
|
204
|
+
|
205
|
+
cdef list is_asteroidal_triple_free_C(uint32_t n,
|
206
|
+
short_digraph sd,
|
207
|
+
uint32_t** connected_structure,
|
208
|
+
uint32_t* waiting_list,
|
209
|
+
bitset_t seen):
|
210
|
+
"""
|
211
|
+
INPUT:
|
212
|
+
|
213
|
+
- ``n`` -- integer; number of points in the graph
|
214
|
+
|
215
|
+
- ``sd`` -- ``short_digraph``; a graph on ``n`` points. This data structure
|
216
|
+
is well documented in the module
|
217
|
+
:mod:`sage.graphs.base.static_sparse_graph`
|
218
|
+
|
219
|
+
- ``connected_structure`` -- bidimensional array of size `n\times n` used to
|
220
|
+
store the connected structure of the graph. All its cells must initially
|
221
|
+
be set to 0.
|
222
|
+
|
223
|
+
- ``waiting_list`` -- an array of size `n` to be used for BFS
|
224
|
+
|
225
|
+
- ``seen`` -- a bitset of size `n`
|
226
|
+
|
227
|
+
ALGORITHM:
|
228
|
+
|
229
|
+
See the module's documentation.
|
230
|
+
"""
|
231
|
+
cdef uint32_t waiting_beginning = 0
|
232
|
+
cdef uint32_t waiting_end = 0
|
233
|
+
cdef uint32_t idx_cc = 0
|
234
|
+
cdef uint32_t source, u, v, w
|
235
|
+
cdef uint32_t* p_tmp
|
236
|
+
cdef uint32_t* end
|
237
|
+
|
238
|
+
# ==> We build the connected structure
|
239
|
+
|
240
|
+
# We run n different BFS taking each vertex as a source
|
241
|
+
for source in range(n):
|
242
|
+
|
243
|
+
# The source is forbidden and seen
|
244
|
+
bitset_clear(seen)
|
245
|
+
bitset_add(seen, source)
|
246
|
+
|
247
|
+
# The neighbors of the source are forbidden and seen
|
248
|
+
p_tmp = sd.neighbors[source]
|
249
|
+
end = sd.neighbors[source + 1]
|
250
|
+
# Iterating over all the outneighbors u of v
|
251
|
+
while p_tmp < end:
|
252
|
+
bitset_add(seen, p_tmp[0])
|
253
|
+
p_tmp += 1
|
254
|
+
|
255
|
+
# We now search for an unseen vertex
|
256
|
+
v = bitset_first_in_complement(seen)
|
257
|
+
while v != <uint32_t>-1:
|
258
|
+
# and add it to the queue
|
259
|
+
waiting_list[0] = v
|
260
|
+
waiting_beginning = 0
|
261
|
+
waiting_end = 0
|
262
|
+
|
263
|
+
# We start a new connected component
|
264
|
+
idx_cc += 1
|
265
|
+
bitset_add(seen, v)
|
266
|
+
connected_structure[source][v] = idx_cc
|
267
|
+
|
268
|
+
# For as long as there are vertices left to explore in this
|
269
|
+
# component
|
270
|
+
while waiting_beginning <= waiting_end:
|
271
|
+
|
272
|
+
# We pick the first one
|
273
|
+
v = waiting_list[waiting_beginning]
|
274
|
+
p_tmp = sd.neighbors[v]
|
275
|
+
end = sd.neighbors[v + 1]
|
276
|
+
|
277
|
+
# Iterating over all the outneighbors u of v
|
278
|
+
while p_tmp < end:
|
279
|
+
u = p_tmp[0]
|
280
|
+
|
281
|
+
# If we notice one of these neighbors is not seen yet, we
|
282
|
+
# add it to the queue to be explored later
|
283
|
+
if not bitset_in(seen, u):
|
284
|
+
waiting_end += 1
|
285
|
+
waiting_list[waiting_end] = u
|
286
|
+
bitset_add(seen, u)
|
287
|
+
connected_structure[source][u] = idx_cc
|
288
|
+
|
289
|
+
p_tmp += 1
|
290
|
+
|
291
|
+
waiting_beginning += 1
|
292
|
+
|
293
|
+
# We search for a possibly unseen vertex
|
294
|
+
v = bitset_first_in_complement(seen)
|
295
|
+
|
296
|
+
# ==> Now that we have the component structure of the graph, we search for
|
297
|
+
# an asteroidal triple.
|
298
|
+
|
299
|
+
# (Possible improvement) right now, the code fixes u and tries to find v,w
|
300
|
+
# in the same connected component of G-N[u] by going over all
|
301
|
+
# binomial(n-1,2) pairs of point. It would be faster to:
|
302
|
+
#
|
303
|
+
# - Iterate on all connected components of G-N[u]
|
304
|
+
# - Enumerate all v,w in G-N[u]
|
305
|
+
#
|
306
|
+
# The list of connected components of G-N[u] can be built from
|
307
|
+
# connected_structure in O(n) time.
|
308
|
+
|
309
|
+
for u in range(n - 2):
|
310
|
+
for v in range(u + 1, n - 1):
|
311
|
+
if connected_structure[u][v]:
|
312
|
+
for w in range(v + 1, n):
|
313
|
+
if (connected_structure[u][v] == connected_structure[u][w] and
|
314
|
+
connected_structure[v][u] == connected_structure[v][w] and
|
315
|
+
connected_structure[w][u] == connected_structure[w][v]):
|
316
|
+
# We have found an asteroidal triple
|
317
|
+
return [u, v, w]
|
318
|
+
|
319
|
+
# No asteroidal triple was found
|
320
|
+
return []
|
sage/graphs/base/all.py
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-graphs
|
Binary file
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-graphs
|
2
|
+
# distutils: language = c++
|
3
|
+
# distutils: extra_compile_args = -std=c++11
|
4
|
+
|
5
|
+
# ***************************************************************************
|
6
|
+
# Copyright (C) 2015 Michele Borassi michele.borassi@imtlucca.it
|
7
|
+
#
|
8
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
9
|
+
# as published by the Free Software Foundation; either version 2 of
|
10
|
+
# the License, or (at your option) any later version.
|
11
|
+
# https://www.gnu.org/licenses/
|
12
|
+
# ***************************************************************************
|
13
|
+
from libcpp.vector cimport vector
|
14
|
+
from libcpp.pair cimport pair
|
15
|
+
|
16
|
+
cdef extern from "boost/graph/adjacency_list.hpp" namespace "boost":
|
17
|
+
cdef cppclass vecS:
|
18
|
+
pass
|
19
|
+
cdef cppclass listS:
|
20
|
+
pass
|
21
|
+
cdef cppclass slistS:
|
22
|
+
pass
|
23
|
+
cdef cppclass setS:
|
24
|
+
pass
|
25
|
+
cdef cppclass multisetS:
|
26
|
+
pass
|
27
|
+
cdef cppclass hash_setS:
|
28
|
+
pass
|
29
|
+
cdef cppclass undirectedS:
|
30
|
+
pass
|
31
|
+
cdef cppclass directedS:
|
32
|
+
pass
|
33
|
+
cdef cppclass bidirectionalS:
|
34
|
+
pass
|
35
|
+
cdef cppclass no_property:
|
36
|
+
pass
|
37
|
+
cdef cppclass edge_weight_t:
|
38
|
+
pass
|
39
|
+
cdef cppclass property[T, U]:
|
40
|
+
pass
|
41
|
+
|
42
|
+
|
43
|
+
cdef extern from "boost_interface.cpp":
|
44
|
+
ctypedef unsigned long v_index
|
45
|
+
ctypedef unsigned long e_index
|
46
|
+
|
47
|
+
cdef cppclass result_ec:
|
48
|
+
v_index ec
|
49
|
+
vector[v_index] edges
|
50
|
+
|
51
|
+
cdef cppclass result_cc:
|
52
|
+
float average_clustering_coefficient
|
53
|
+
vector[float] clust_of_v
|
54
|
+
|
55
|
+
cdef cppclass result_distances:
|
56
|
+
vector[double] distances
|
57
|
+
vector[v_index] predecessors
|
58
|
+
|
59
|
+
cdef cppclass BoostGraph[OutEdgeListS, VertexListS, DirectedS, EdgeListS, EdgeProperty]:
|
60
|
+
BoostGraph()
|
61
|
+
void add_vertex()
|
62
|
+
v_index num_verts()
|
63
|
+
void add_edge(v_index u, v_index v)
|
64
|
+
void add_edge(v_index u, v_index v, double w)
|
65
|
+
vector[pair[v_index, pair[v_index, double]]] edge_list()
|
66
|
+
e_index num_edges()
|
67
|
+
result_ec edge_connectivity()
|
68
|
+
double clustering_coeff(v_index v)
|
69
|
+
result_cc clustering_coeff_all()
|
70
|
+
vector[v_index] dominator_tree(v_index v)
|
71
|
+
vector[v_index] bandwidth_ordering(bool)
|
72
|
+
vector[v_index] kruskal_min_spanning_tree()
|
73
|
+
vector[v_index] prim_min_spanning_tree()
|
74
|
+
vector[vector[v_index]] blocks_and_cut_vertices()
|
75
|
+
result_distances dijkstra_shortest_paths(v_index s)
|
76
|
+
result_distances bellman_ford_shortest_paths(v_index s)
|
77
|
+
vector[vector[double]] johnson_shortest_paths()
|
78
|
+
vector[vector[double]] floyd_warshall_shortest_paths()
|
79
|
+
|
80
|
+
ctypedef property[edge_weight_t, double] EdgeWeight
|
81
|
+
|
82
|
+
ctypedef BoostGraph[vecS, vecS, undirectedS, vecS, no_property] BoostVecGraph
|
83
|
+
ctypedef BoostGraph[vecS, vecS, bidirectionalS, vecS, no_property] BoostVecDiGraph
|
84
|
+
|
85
|
+
ctypedef BoostGraph[vecS, vecS, undirectedS, vecS, EdgeWeight] BoostVecWeightedGraph
|
86
|
+
ctypedef BoostGraph[vecS, vecS, directedS, vecS, EdgeWeight] BoostVecWeightedDiGraphU
|
87
|
+
ctypedef BoostGraph[vecS, vecS, bidirectionalS, vecS, EdgeWeight] BoostVecWeightedDiGraph
|
88
|
+
|
89
|
+
ctypedef BoostGraph[setS, vecS, undirectedS, vecS, no_property] BoostSetGraph
|
90
|
+
|
91
|
+
ctypedef fused BoostVecGenGraph:
|
92
|
+
BoostVecGraph
|
93
|
+
BoostVecDiGraph
|
94
|
+
|
95
|
+
ctypedef fused BoostWeightedGraph:
|
96
|
+
BoostVecWeightedGraph
|
97
|
+
BoostVecWeightedDiGraph
|
98
|
+
BoostVecWeightedDiGraphU
|
99
|
+
|
100
|
+
ctypedef fused BoostGenGraph:
|
101
|
+
BoostVecGraph
|
102
|
+
BoostVecDiGraph
|
103
|
+
BoostGraph[vecS, vecS, directedS, vecS, no_property]
|
104
|
+
BoostSetGraph
|
105
|
+
BoostGraph[setS, vecS, directedS, vecS, no_property]
|
106
|
+
BoostGraph[setS, vecS, bidirectionalS, vecS, no_property]
|