passagemath-graphs 10.5.10__cp39-cp39-macosx_14_0_arm64.whl → 10.5.43__cp39-cp39-macosx_14_0_arm64.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.5.10.dist-info → passagemath_graphs-10.5.43.dist-info}/METADATA +126 -30
- passagemath_graphs-10.5.43.dist-info/RECORD +256 -0
- {passagemath_graphs-10.5.10.dist-info → passagemath_graphs-10.5.43.dist-info}/WHEEL +2 -1
- passagemath_graphs.dylibs/libgmp.10.dylib +0 -0
- sage/all__sagemath_graphs.py +5 -0
- sage/combinat/abstract_tree.py +1 -1
- sage/combinat/binary_tree.py +1 -1
- sage/combinat/cluster_algebra_quiver/all.py +1 -1
- sage/combinat/cluster_algebra_quiver/cluster_seed.py +28 -24
- sage/combinat/cluster_algebra_quiver/interact.py +4 -0
- sage/combinat/designs/MOLS_handbook_data.py +5 -5
- sage/combinat/designs/bibd.py +10 -9
- sage/combinat/designs/covering_array.py +3 -3
- sage/combinat/designs/covering_design.py +2 -1
- sage/combinat/designs/database.py +11 -10
- sage/combinat/designs/designs_pyx.cpython-39-darwin.so +0 -0
- sage/combinat/designs/designs_pyx.pyx +13 -45
- sage/combinat/designs/difference_family.py +6 -6
- sage/combinat/designs/difference_matrices.py +1 -1
- sage/combinat/designs/evenly_distributed_sets.cpython-39-darwin.so +0 -0
- sage/combinat/designs/evenly_distributed_sets.pyx +15 -22
- sage/combinat/designs/ext_rep.py +9 -14
- sage/combinat/designs/gen_quadrangles_with_spread.cpython-39-darwin.so +0 -0
- sage/combinat/designs/gen_quadrangles_with_spread.pyx +1 -1
- sage/combinat/designs/group_divisible_designs.py +1 -1
- sage/combinat/designs/incidence_structures.py +8 -8
- sage/combinat/designs/latin_squares.py +1 -1
- sage/combinat/designs/orthogonal_arrays_build_recursive.py +8 -7
- sage/combinat/designs/orthogonal_arrays_find_recursive.cpython-39-darwin.so +0 -0
- sage/combinat/designs/resolvable_bibd.py +1 -1
- sage/combinat/designs/steiner_quadruple_systems.py +1 -1
- sage/combinat/designs/subhypergraph_search.cpython-39-darwin.so +0 -0
- sage/combinat/designs/subhypergraph_search.pyx +9 -9
- sage/combinat/finite_state_machine_generators.py +2 -2
- sage/combinat/graph_path.py +3 -3
- sage/combinat/interval_posets.py +10 -10
- sage/combinat/ordered_tree.py +1 -1
- sage/combinat/posets/cartesian_product.py +1 -1
- sage/combinat/posets/d_complete.py +1 -1
- sage/combinat/posets/forest.py +1 -1
- sage/combinat/posets/hasse_cython.cpython-39-darwin.so +0 -0
- sage/combinat/posets/hasse_diagram.py +8 -6
- sage/combinat/posets/incidence_algebras.py +8 -8
- sage/combinat/posets/lattices.py +28 -4
- sage/combinat/posets/linear_extension_iterator.cpython-39-darwin.so +0 -0
- sage/combinat/posets/linear_extension_iterator.pyx +2 -0
- sage/combinat/posets/linear_extensions.py +7 -16
- sage/combinat/posets/moebius_algebra.py +1 -1
- sage/combinat/posets/poset_examples.py +1 -1
- sage/combinat/posets/posets.py +54 -56
- sage/combinat/rooted_tree.py +3 -3
- sage/combinat/tamari_lattices.py +1 -1
- 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/asteroidal_triples.cpython-39-darwin.so +0 -0
- sage/graphs/base/boost_graph.cpython-39-darwin.so +0 -0
- sage/graphs/base/boost_graph.pxd +1 -1
- sage/graphs/base/boost_graph.pyx +1 -1
- sage/graphs/base/c_graph.cpython-39-darwin.so +0 -0
- sage/graphs/base/c_graph.pxd +4 -4
- sage/graphs/base/c_graph.pyx +270 -184
- sage/graphs/base/dense_graph.cpython-39-darwin.so +0 -0
- sage/graphs/base/graph_backends.cpython-39-darwin.so +0 -0
- sage/graphs/base/sparse_graph.cpython-39-darwin.so +0 -0
- sage/graphs/base/static_dense_graph.cpython-39-darwin.so +0 -0
- sage/graphs/base/static_sparse_backend.cpython-39-darwin.so +0 -0
- sage/graphs/base/static_sparse_backend.pyx +93 -6
- sage/graphs/base/static_sparse_graph.cpython-39-darwin.so +0 -0
- sage/graphs/base/static_sparse_graph.pyx +1 -1
- sage/graphs/bipartite_graph.py +0 -1
- sage/graphs/centrality.cpython-39-darwin.so +0 -0
- sage/graphs/centrality.pyx +0 -0
- sage/graphs/comparability.cpython-39-darwin.so +0 -0
- sage/graphs/comparability.pyx +172 -138
- sage/graphs/connectivity.cpython-39-darwin.so +0 -0
- sage/graphs/connectivity.pyx +194 -18
- sage/graphs/convexity_properties.cpython-39-darwin.so +0 -0
- sage/graphs/digraph_generators.py +118 -74
- sage/graphs/distances_all_pairs.cpython-39-darwin.so +0 -0
- sage/graphs/distances_all_pairs.pyx +145 -27
- sage/graphs/edge_connectivity.cpython-39-darwin.so +0 -0
- sage/graphs/generators/basic.py +471 -130
- sage/graphs/generators/distance_regular.cpython-39-darwin.so +0 -0
- sage/graphs/generators/distance_regular.pyx +12 -12
- sage/graphs/generators/families.py +2 -2
- sage/graphs/generators/random.py +8 -13
- sage/graphs/generators/smallgraphs.py +12 -11
- sage/graphs/generic_graph.py +687 -265
- sage/graphs/generic_graph_pyx.cpython-39-darwin.so +0 -0
- sage/graphs/genus.cpython-39-darwin.so +0 -0
- sage/graphs/graph.py +12 -46
- sage/graphs/graph_coloring.cpython-39-darwin.so +0 -0
- sage/graphs/graph_database.py +1 -1
- sage/graphs/graph_decompositions/bandwidth.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/clique_separators.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/cutwidth.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/fast_digraph.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/graph_products.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/modular_decomposition.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/slice_decomposition.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/tree_decomposition.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/vertex_separation.cpython-39-darwin.so +0 -0
- sage/graphs/graph_generators.py +110 -55
- sage/graphs/graph_generators_pyx.cpython-39-darwin.so +0 -0
- sage/graphs/graph_latex.py +1 -1
- sage/graphs/graph_list.py +2 -3
- sage/graphs/graph_plot.py +225 -30
- sage/graphs/hyperbolicity.cpython-39-darwin.so +0 -0
- sage/graphs/independent_sets.cpython-39-darwin.so +0 -0
- sage/graphs/isgci.py +3 -8
- sage/graphs/isoperimetric_inequalities.cpython-39-darwin.so +0 -0
- sage/graphs/line_graph.cpython-39-darwin.so +0 -0
- sage/graphs/matching.py +14 -25
- sage/graphs/matching_covered_graph.py +871 -60
- sage/graphs/orientations.py +190 -134
- sage/graphs/path_enumeration.cpython-39-darwin.so +0 -0
- sage/graphs/path_enumeration.pyx +25 -25
- sage/graphs/spanning_tree.cpython-39-darwin.so +0 -0
- sage/graphs/strongly_regular_db.cpython-39-darwin.so +0 -0
- sage/graphs/strongly_regular_db.pyx +54 -52
- sage/graphs/traversals.cpython-39-darwin.so +0 -0
- sage/graphs/traversals.pyx +114 -46
- sage/graphs/trees.cpython-39-darwin.so +0 -0
- sage/graphs/views.cpython-39-darwin.so +0 -0
- sage/graphs/weakly_chordal.cpython-39-darwin.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_graphs.cpython-39-darwin.so +0 -0
- sage/knots/free_knotinfo_monoid.py +2 -3
- sage/knots/knot.py +1 -1
- sage/knots/knotinfo.py +4 -4
- sage/knots/link.py +58 -57
- sage/sandpiles/sandpile.py +2 -3
- sage/topology/cell_complex.py +1 -1
- sage/topology/cubical_complex.py +7 -7
- sage/topology/delta_complex.py +4 -4
- sage/topology/simplicial_complex.py +7 -22
- passagemath_graphs-10.5.10.dist-info/RECORD +0 -251
- {passagemath_graphs-10.5.10.dist-info → passagemath_graphs-10.5.43.dist-info}/top_level.txt +0 -0
Binary file
|
Binary file
|
sage/graphs/graph.py
CHANGED
@@ -105,7 +105,7 @@ covered here.
|
|
105
105
|
::
|
106
106
|
|
107
107
|
sage: d = {0: [1,4,5], 1: [2,6], 2: [3,7], 3: [4,8], 4: [9], \
|
108
|
-
|
108
|
+
....: 5: [7, 8], 6: [8,9], 7: [9]}
|
109
109
|
sage: G = Graph(d); G
|
110
110
|
Graph on 10 vertices
|
111
111
|
sage: G.plot().show() # or G.show() # needs sage.plot
|
@@ -311,7 +311,7 @@ However, if one wants to define a dictionary, with the same keys and arbitrary
|
|
311
311
|
objects for entries, one can make that association::
|
312
312
|
|
313
313
|
sage: d = {0 : graphs.DodecahedralGraph(), 1 : graphs.FlowerSnark(), \
|
314
|
-
|
314
|
+
....: 2 : graphs.MoebiusKantorGraph(), 3 : graphs.PetersenGraph() }
|
315
315
|
sage: d[2]
|
316
316
|
Moebius-Kantor Graph: Graph on 16 vertices
|
317
317
|
sage: T = graphs.TetrahedralGraph()
|
@@ -379,7 +379,7 @@ suitable for inclusion in a `\LaTeX` document. More details on this are at the
|
|
379
379
|
|
380
380
|
sage: from sage.graphs.graph_latex import check_tkz_graph
|
381
381
|
sage: check_tkz_graph() # random - depends on TeX installation
|
382
|
-
sage: latex(G)
|
382
|
+
sage: latex(G) # needs sage.plot
|
383
383
|
\begin{tikzpicture}
|
384
384
|
...
|
385
385
|
\end{tikzpicture}
|
@@ -5276,42 +5276,12 @@ class Graph(GenericGraph):
|
|
5276
5276
|
sage: D.get_vertices()
|
5277
5277
|
{0: 'foo', 1: None, 2: None}
|
5278
5278
|
"""
|
5279
|
-
|
5280
|
-
|
5281
|
-
|
5282
|
-
|
5283
|
-
|
5284
|
-
|
5285
|
-
if data_structure is None:
|
5286
|
-
from sage.graphs.base.dense_graph import DenseGraphBackend
|
5287
|
-
from sage.graphs.base.sparse_graph import SparseGraphBackend
|
5288
|
-
if isinstance(self._backend, DenseGraphBackend):
|
5289
|
-
data_structure = "dense"
|
5290
|
-
elif isinstance(self._backend, SparseGraphBackend):
|
5291
|
-
data_structure = "sparse"
|
5292
|
-
else:
|
5293
|
-
data_structure = "static_sparse"
|
5294
|
-
from sage.graphs.digraph import DiGraph
|
5295
|
-
D = DiGraph(name=self.name(),
|
5296
|
-
pos=self.get_pos(),
|
5297
|
-
multiedges=self.allows_multiple_edges(),
|
5298
|
-
loops=self.allows_loops(),
|
5299
|
-
data_structure=(data_structure if data_structure != "static_sparse"
|
5300
|
-
else "sparse")) # we need a mutable copy
|
5301
|
-
|
5302
|
-
D.add_vertices(self.vertex_iterator())
|
5303
|
-
D.set_vertices(self.get_vertices())
|
5304
|
-
for u, v, l in self.edge_iterator():
|
5305
|
-
D.add_edge(u, v, l)
|
5306
|
-
D.add_edge(v, u, l)
|
5307
|
-
if hasattr(self, '_embedding'):
|
5308
|
-
D._embedding = copy(self._embedding)
|
5309
|
-
D._weighted = self._weighted
|
5310
|
-
|
5311
|
-
if data_structure == "static_sparse":
|
5312
|
-
D = D.copy(data_structure=data_structure)
|
5313
|
-
|
5314
|
-
return D
|
5279
|
+
from sage.graphs.orientations import _initialize_digraph
|
5280
|
+
from itertools import chain
|
5281
|
+
edges = chain(self.edge_iterator(),
|
5282
|
+
((v, u, l) for u, v, l in self.edge_iterator()))
|
5283
|
+
return _initialize_digraph(self, edges, name=self.name(),
|
5284
|
+
data_structure=data_structure, sparse=sparse)
|
5315
5285
|
|
5316
5286
|
@doc_index("Basic methods")
|
5317
5287
|
def to_undirected(self):
|
@@ -5535,7 +5505,7 @@ class Graph(GenericGraph):
|
|
5535
5505
|
# Triangles
|
5536
5506
|
K3 = Graph({1: [2, 3], 2: [3]}, format='dict_of_lists')
|
5537
5507
|
for x, y, z in G.subgraph_search_iterator(K3, return_graphs=False):
|
5538
|
-
if x < y
|
5508
|
+
if x < y < z:
|
5539
5509
|
T.append([x, y, z])
|
5540
5510
|
|
5541
5511
|
# Triples with just one edge
|
@@ -5828,12 +5798,6 @@ class Graph(GenericGraph):
|
|
5828
5798
|
implementation of the Bron and Kerbosch Algorithm [BK1973]_
|
5829
5799
|
|
5830
5800
|
|
5831
|
-
.. NOTE::
|
5832
|
-
|
5833
|
-
This method sorts its output before returning it. If you prefer to
|
5834
|
-
save the extra time, you can call
|
5835
|
-
:class:`sage.graphs.independent_sets.IndependentSets` directly.
|
5836
|
-
|
5837
5801
|
.. NOTE::
|
5838
5802
|
|
5839
5803
|
Sage's implementation of the enumeration of *maximal* independent
|
@@ -9311,6 +9275,7 @@ class Graph(GenericGraph):
|
|
9311
9275
|
from sage.graphs.orientations import eulerian_orientation
|
9312
9276
|
from sage.graphs.connectivity import bridges, cleave, spqr_tree
|
9313
9277
|
from sage.graphs.connectivity import is_triconnected
|
9278
|
+
from sage.graphs.connectivity import minimal_separators
|
9314
9279
|
from sage.graphs.comparability import is_comparability
|
9315
9280
|
from sage.graphs.comparability import is_permutation
|
9316
9281
|
geodetic_closure = LazyImport('sage.graphs.convexity_properties', 'geodetic_closure', at_startup=True)
|
@@ -9371,6 +9336,7 @@ _additional_categories = {
|
|
9371
9336
|
"cleave" : "Connectivity, orientations, trees",
|
9372
9337
|
"spqr_tree" : "Connectivity, orientations, trees",
|
9373
9338
|
"is_triconnected" : "Connectivity, orientations, trees",
|
9339
|
+
"minimal_separators" : "Connectivity, orientations, trees",
|
9374
9340
|
"is_dominating" : "Domination",
|
9375
9341
|
"is_redundant" : "Domination",
|
9376
9342
|
"private_neighbors" : "Domination",
|
Binary file
|
sage/graphs/graph_database.py
CHANGED
@@ -430,7 +430,7 @@ class GraphQuery(GenericGraphQuery):
|
|
430
430
|
SQLQuery.__init__(self, graph_db)
|
431
431
|
|
432
432
|
# if display_cols is None:
|
433
|
-
#
|
433
|
+
# raise TypeError('Nonetype display_cols cannot retrieve data')
|
434
434
|
|
435
435
|
master_join = {}
|
436
436
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
sage/graphs/graph_generators.py
CHANGED
@@ -487,9 +487,6 @@ Functions and methods
|
|
487
487
|
# https://www.gnu.org/licenses/
|
488
488
|
# ****************************************************************************
|
489
489
|
|
490
|
-
# import from Python standard library
|
491
|
-
|
492
|
-
# import from Sage library
|
493
490
|
from . import graph
|
494
491
|
|
495
492
|
|
@@ -574,14 +571,19 @@ class GraphGenerators:
|
|
574
571
|
- ``sparse`` -- (default: ``True``) whether to use a sparse or dense data
|
575
572
|
structure. See the documentation of :class:`~sage.graphs.graph.Graph`.
|
576
573
|
|
577
|
-
- ``copy`` -- boolean
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
574
|
+
- ``copy`` -- boolean (default: ``True``); whether to return copies. If set
|
575
|
+
to ``False`` the method returns the graph it is working on. The second
|
576
|
+
alternative is faster, but modifying any of the graph instances returned
|
577
|
+
by the method may break the function's behaviour, as it is using these
|
578
|
+
graphs to compute the next ones: only use ``copy=False`` when you stick
|
579
|
+
to *reading* the graphs returned.
|
580
|
+
|
581
|
+
This parameter is ignored when ``immutable`` is set to ``True``, in which
|
582
|
+
case returned graphs are always copies.
|
583
|
+
|
584
|
+
- ``immutable`` -- boolean (default: ``False``); whether to return immutable
|
585
|
+
or mutable graphs. When set to ``True``, this parameter implies
|
586
|
+
``copy=True``.
|
585
587
|
|
586
588
|
EXAMPLES:
|
587
589
|
|
@@ -751,6 +753,24 @@ class GraphGenerators:
|
|
751
753
|
2
|
752
754
|
2
|
753
755
|
|
756
|
+
Returned graphs can be mutable or immutable::
|
757
|
+
|
758
|
+
sage: # needs nauty
|
759
|
+
sage: G = next(graphs(3, immutable=False))
|
760
|
+
sage: G.delete_vertex(0)
|
761
|
+
sage: G = next(graphs(3, immutable=True))
|
762
|
+
sage: G.delete_vertex(0)
|
763
|
+
Traceback (most recent call last):
|
764
|
+
...
|
765
|
+
ValueError: graph is immutable; please change a copy instead (use function copy())
|
766
|
+
sage: G = next(graphs(4, degree_sequence=[3]*4))
|
767
|
+
sage: G.delete_vertex(0)
|
768
|
+
sage: G = next(graphs(4, degree_sequence=[3]*4, immutable=True))
|
769
|
+
sage: G.delete_vertex(0)
|
770
|
+
Traceback (most recent call last):
|
771
|
+
...
|
772
|
+
ValueError: graph is immutable; please change a copy instead (use function copy())
|
773
|
+
|
754
774
|
REFERENCE:
|
755
775
|
|
756
776
|
- Brendan D. McKay, Isomorph-Free Exhaustive generation. *Journal
|
@@ -762,7 +782,8 @@ class GraphGenerators:
|
|
762
782
|
###########################################################################
|
763
783
|
|
764
784
|
def __call__(self, vertices=None, property=None, augment='edges', size=None,
|
765
|
-
degree_sequence=None, loops=False, sparse=True, copy=True
|
785
|
+
degree_sequence=None, loops=False, sparse=True, copy=True,
|
786
|
+
immutable=False):
|
766
787
|
"""
|
767
788
|
Access the generator of isomorphism class representatives.
|
768
789
|
Iterates over distinct, exhaustive representatives. See the docstring
|
@@ -812,18 +833,14 @@ class GraphGenerators:
|
|
812
833
|
# Use nauty for the basic case, as it is much faster.
|
813
834
|
if (vertices and property is None and size is None and
|
814
835
|
degree_sequence is None and not loops and augment == 'edges' and
|
815
|
-
sparse and copy):
|
816
|
-
|
817
|
-
yield g
|
836
|
+
sparse and (copy or immutable)):
|
837
|
+
yield from graphs.nauty_geng(vertices, immutable=immutable)
|
818
838
|
return
|
819
839
|
|
820
840
|
if property is None:
|
821
841
|
def property(x):
|
822
842
|
return True
|
823
843
|
|
824
|
-
from sage.graphs.graph import Graph
|
825
|
-
from copy import copy as copyfun
|
826
|
-
|
827
844
|
if degree_sequence is not None:
|
828
845
|
if vertices is None:
|
829
846
|
raise NotImplementedError
|
@@ -857,19 +874,19 @@ class GraphGenerators:
|
|
857
874
|
if augment == 'vertices':
|
858
875
|
if vertices is None:
|
859
876
|
raise NotImplementedError
|
860
|
-
g = Graph(loops=loops, sparse=sparse)
|
877
|
+
g = graph.Graph(loops=loops, sparse=sparse)
|
861
878
|
for gg in canaug_traverse_vert(g, [], vertices, property, loops=loops, sparse=sparse):
|
862
879
|
if extra_property(gg):
|
863
|
-
yield
|
880
|
+
yield gg.copy(immutable=immutable) if copy or immutable else gg
|
864
881
|
elif augment == 'edges':
|
865
882
|
if vertices is None:
|
866
883
|
from sage.rings.integer import Integer
|
867
884
|
vertices = Integer(0)
|
868
885
|
while True:
|
869
886
|
for g in self(vertices, loops=loops, sparse=sparse):
|
870
|
-
yield
|
887
|
+
yield g.copy(immutable=immutable) if copy or immutable else g
|
871
888
|
vertices += 1
|
872
|
-
g = Graph(vertices, loops=loops, sparse=sparse)
|
889
|
+
g = graph.Graph(vertices, loops=loops, sparse=sparse)
|
873
890
|
gens = []
|
874
891
|
for i in range(vertices - 1):
|
875
892
|
gen = list(range(i))
|
@@ -879,11 +896,11 @@ class GraphGenerators:
|
|
879
896
|
gens.append(gen)
|
880
897
|
for gg in canaug_traverse_edge(g, gens, property, loops=loops, sparse=sparse):
|
881
898
|
if extra_property(gg):
|
882
|
-
yield
|
899
|
+
yield gg.copy(immutable=immutable) if copy or immutable else gg
|
883
900
|
else:
|
884
901
|
raise NotImplementedError
|
885
902
|
|
886
|
-
def nauty_geng(self, options='', debug=False):
|
903
|
+
def nauty_geng(self, options='', debug=False, immutable=False):
|
887
904
|
r"""
|
888
905
|
Return a generator which creates graphs from nauty's geng program.
|
889
906
|
|
@@ -902,6 +919,9 @@ class GraphGenerators:
|
|
902
919
|
the program with some information on the arguments, while a line
|
903
920
|
beginning with ">E" indicates an error with the input.
|
904
921
|
|
922
|
+
- ``immutable`` -- boolean (default: ``False``); whether to return
|
923
|
+
immutable or mutable graphs
|
924
|
+
|
905
925
|
The possible options, obtained as output of ``geng --help``::
|
906
926
|
|
907
927
|
n : the number of vertices
|
@@ -1029,10 +1049,9 @@ class GraphGenerators:
|
|
1029
1049
|
except StopIteration:
|
1030
1050
|
# Exhausted list of graphs from nauty geng
|
1031
1051
|
return
|
1032
|
-
|
1033
|
-
yield G
|
1052
|
+
yield graph.Graph(s[:-1], format='graph6', immutable=immutable)
|
1034
1053
|
|
1035
|
-
def nauty_genbg(self, options='', debug=False):
|
1054
|
+
def nauty_genbg(self, options='', debug=False, immutable=False):
|
1036
1055
|
r"""
|
1037
1056
|
Return a generator which creates bipartite graphs from nauty's ``genbgL``
|
1038
1057
|
program.
|
@@ -1052,6 +1071,9 @@ class GraphGenerators:
|
|
1052
1071
|
the program with some information on the arguments, while a line
|
1053
1072
|
beginning with ">E" indicates an error with the input.
|
1054
1073
|
|
1074
|
+
- ``immutable`` -- boolean (default: ``False``); whether to return
|
1075
|
+
immutable or mutable graphs
|
1076
|
+
|
1055
1077
|
The possible options, obtained as output of ``genbgL --help``::
|
1056
1078
|
|
1057
1079
|
n1 : the number of vertices in the first class.
|
@@ -1237,10 +1259,10 @@ class GraphGenerators:
|
|
1237
1259
|
except StopIteration:
|
1238
1260
|
# Exhausted list of bipartite graphs from nauty genbgL
|
1239
1261
|
return
|
1240
|
-
|
1241
|
-
|
1262
|
+
yield BipartiteGraph(s[:-1], format='graph6', partition=partition,
|
1263
|
+
immutable=immutable)
|
1242
1264
|
|
1243
|
-
def nauty_genktreeg(self, options='', debug=False):
|
1265
|
+
def nauty_genktreeg(self, options='', debug=False, immutable=False):
|
1244
1266
|
r"""
|
1245
1267
|
Return a generator which creates all `k`-trees using nauty..
|
1246
1268
|
|
@@ -1265,6 +1287,9 @@ class GraphGenerators:
|
|
1265
1287
|
the program with some information on the arguments, while a line
|
1266
1288
|
beginning with ">E" indicates an error with the input.
|
1267
1289
|
|
1290
|
+
- ``immutable`` -- boolean (default: ``False``); whether to return
|
1291
|
+
immutable or mutable graphs
|
1292
|
+
|
1268
1293
|
The possible options, obtained as output of ``genktreeg --help``::
|
1269
1294
|
|
1270
1295
|
n : the number of vertices
|
@@ -1352,10 +1377,10 @@ class GraphGenerators:
|
|
1352
1377
|
except StopIteration:
|
1353
1378
|
# Exhausted list of graphs from nauty geng
|
1354
1379
|
return
|
1355
|
-
|
1356
|
-
yield G
|
1380
|
+
yield graph.Graph(s[:-1], format='graph6', immutable=immutable)
|
1357
1381
|
|
1358
|
-
def cospectral_graphs(self, vertices, matrix_function=None, graphs=None
|
1382
|
+
def cospectral_graphs(self, vertices, matrix_function=None, graphs=None,
|
1383
|
+
immutable=False):
|
1359
1384
|
r"""
|
1360
1385
|
Find all sets of graphs on ``vertices`` vertices (with
|
1361
1386
|
possible restrictions) which are cospectral with respect to a
|
@@ -1382,6 +1407,9 @@ class GraphGenerators:
|
|
1382
1407
|
are tested for cospectral sets. In this case,
|
1383
1408
|
``vertices`` is ignored.
|
1384
1409
|
|
1410
|
+
- ``immutable`` -- boolean (default: ``False``); whether to return
|
1411
|
+
immutable or mutable graphs
|
1412
|
+
|
1385
1413
|
OUTPUT:
|
1386
1414
|
|
1387
1415
|
A list of lists of graphs. Each sublist will be a list of
|
@@ -1454,11 +1482,15 @@ class GraphGenerators:
|
|
1454
1482
|
if matrix_function is None:
|
1455
1483
|
matrix_function = lambda g: g.adjacency_matrix()
|
1456
1484
|
|
1485
|
+
def prop(x):
|
1486
|
+
return True
|
1487
|
+
|
1457
1488
|
from sage.graphs.graph_generators import graphs as graph_gen
|
1458
1489
|
if graphs is None:
|
1459
|
-
graph_list = graph_gen(vertices, property=
|
1490
|
+
graph_list = graph_gen(vertices, property=prop, immutable=immutable)
|
1460
1491
|
elif callable(graphs):
|
1461
|
-
graph_list =
|
1492
|
+
graph_list = (g for g in graph_gen(vertices, property=prop,
|
1493
|
+
immutable=immutable) if graphs(g))
|
1462
1494
|
else:
|
1463
1495
|
graph_list = iter(graphs)
|
1464
1496
|
|
@@ -1475,7 +1507,7 @@ class GraphGenerators:
|
|
1475
1507
|
|
1476
1508
|
return cospectral_graphs
|
1477
1509
|
|
1478
|
-
def _read_planar_code(self, code_input):
|
1510
|
+
def _read_planar_code(self, code_input, immutable=False):
|
1479
1511
|
r"""
|
1480
1512
|
Return a generator for the plane graphs in planar code format in
|
1481
1513
|
the file code_input (see [BM2016]_).
|
@@ -1494,6 +1526,9 @@ class GraphGenerators:
|
|
1494
1526
|
|
1495
1527
|
- ``code_input`` -- a file containing valid planar code data
|
1496
1528
|
|
1529
|
+
- ``immutable`` -- boolean (default: ``False``); whether to return
|
1530
|
+
immutable or mutable graphs
|
1531
|
+
|
1497
1532
|
OUTPUT:
|
1498
1533
|
|
1499
1534
|
A generator which will produce the plane graphs as Sage graphs
|
@@ -1575,14 +1610,14 @@ class GraphGenerators:
|
|
1575
1610
|
if Ni > 1:
|
1576
1611
|
edges_g[i + 1] += [i + 1] * (Ni // 2)
|
1577
1612
|
has_loops = True
|
1578
|
-
G = graph.Graph(edges_g, loops=has_loops)
|
1613
|
+
G = graph.Graph(edges_g, loops=has_loops, immutable=immutable)
|
1579
1614
|
|
1580
1615
|
if not (G.has_multiple_edges() or has_loops):
|
1581
1616
|
embed_g = {i + 1: di for i, di in enumerate(g)}
|
1582
1617
|
G.set_embedding(embed_g)
|
1583
1618
|
yield G
|
1584
1619
|
|
1585
|
-
def fullerenes(self, order, ipr=False):
|
1620
|
+
def fullerenes(self, order, ipr=False, immutable=False):
|
1586
1621
|
r"""
|
1587
1622
|
Return a generator which creates fullerene graphs using
|
1588
1623
|
the buckygen generator (see [BGM2012]_).
|
@@ -1592,10 +1627,13 @@ class GraphGenerators:
|
|
1592
1627
|
- ``order`` -- a positive even integer smaller than or equal to 254
|
1593
1628
|
This specifies the number of vertices in the generated fullerenes
|
1594
1629
|
|
1595
|
-
- ``ipr`` -- (default: ``False``) if ``True`` only fullerenes
|
1596
|
-
satisfy the Isolated Pentagon Rule are generated. This means that
|
1630
|
+
- ``ipr`` -- boolean (default: ``False``); if ``True`` only fullerenes
|
1631
|
+
that satisfy the Isolated Pentagon Rule are generated. This means that
|
1597
1632
|
no pentagonal faces share an edge.
|
1598
1633
|
|
1634
|
+
- ``immutable`` -- boolean (default: ``False``); whether to return
|
1635
|
+
immutable or mutable graphs
|
1636
|
+
|
1599
1637
|
OUTPUT:
|
1600
1638
|
|
1601
1639
|
A generator which will produce the fullerene graphs as Sage graphs
|
@@ -1687,9 +1725,9 @@ class GraphGenerators:
|
|
1687
1725
|
|
1688
1726
|
sp.stdout.reconfigure(newline='')
|
1689
1727
|
|
1690
|
-
yield from graphs._read_planar_code(sp.stdout)
|
1728
|
+
yield from graphs._read_planar_code(sp.stdout, immutable=immutable)
|
1691
1729
|
|
1692
|
-
def fusenes(self, hexagon_count, benzenoids=False):
|
1730
|
+
def fusenes(self, hexagon_count, benzenoids=False, immutable=False):
|
1693
1731
|
r"""
|
1694
1732
|
Return a generator which creates fusenes and benzenoids using
|
1695
1733
|
the benzene generator (see [BCH2002]_). Fusenes are planar
|
@@ -1701,8 +1739,11 @@ class GraphGenerators:
|
|
1701
1739
|
- ``hexagon_count`` -- positive integer smaller than or equal to 30;
|
1702
1740
|
this specifies the number of hexagons in the generated benzenoids
|
1703
1741
|
|
1704
|
-
- ``benzenoids`` -- (default: ``False``) if ``True`` only
|
1705
|
-
generated
|
1742
|
+
- ``benzenoids`` -- boolean (default: ``False``); if ``True`` only
|
1743
|
+
benzenoids are generated
|
1744
|
+
|
1745
|
+
- ``immutable`` -- boolean (default: ``False``); whether to return
|
1746
|
+
immutable or mutable graphs
|
1706
1747
|
|
1707
1748
|
OUTPUT:
|
1708
1749
|
|
@@ -1775,10 +1816,9 @@ class GraphGenerators:
|
|
1775
1816
|
|
1776
1817
|
sp.stdout.reconfigure(newline='')
|
1777
1818
|
|
1778
|
-
|
1779
|
-
yield G
|
1819
|
+
yield from graphs._read_planar_code(sp.stdout, immutable=immutable)
|
1780
1820
|
|
1781
|
-
def plantri_gen(self, options=""):
|
1821
|
+
def plantri_gen(self, options="", immutable=False):
|
1782
1822
|
r"""
|
1783
1823
|
Iterator over planar graphs created using the ``plantri`` generator.
|
1784
1824
|
|
@@ -1801,6 +1841,9 @@ class GraphGenerators:
|
|
1801
1841
|
output of plantri to be in "planar code" format, so do not set an
|
1802
1842
|
option to change this default or results will be unpredictable.
|
1803
1843
|
|
1844
|
+
- ``immutable`` -- boolean (default: ``False``); whether to return
|
1845
|
+
immutable or mutable graphs
|
1846
|
+
|
1804
1847
|
The possible options are::
|
1805
1848
|
|
1806
1849
|
n : the number of vertices (the only compulsory parameter).
|
@@ -1962,7 +2005,7 @@ class GraphGenerators:
|
|
1962
2005
|
sp.stdout.reconfigure(newline='')
|
1963
2006
|
|
1964
2007
|
try:
|
1965
|
-
yield from graphs._read_planar_code(sp.stdout)
|
2008
|
+
yield from graphs._read_planar_code(sp.stdout, immutable=immutable)
|
1966
2009
|
except AssertionError:
|
1967
2010
|
raise AttributeError("invalid options '{}'".format(options))
|
1968
2011
|
|
@@ -1973,7 +2016,8 @@ class GraphGenerators:
|
|
1973
2016
|
maximum_edges=None,
|
1974
2017
|
maximum_face_size=None,
|
1975
2018
|
only_bipartite=False,
|
1976
|
-
dual=False
|
2019
|
+
dual=False,
|
2020
|
+
immutable=False):
|
1977
2021
|
r"""
|
1978
2022
|
An iterator over connected planar graphs using the plantri generator.
|
1979
2023
|
|
@@ -2025,6 +2069,9 @@ class GraphGenerators:
|
|
2025
2069
|
- ``dual`` -- (default: ``False``) if ``True`` return instead the
|
2026
2070
|
planar duals of the generated graphs
|
2027
2071
|
|
2072
|
+
- ``immutable`` -- boolean (default: ``False``); whether to return
|
2073
|
+
immutable or mutable graphs
|
2074
|
+
|
2028
2075
|
OUTPUT:
|
2029
2076
|
|
2030
2077
|
An iterator which will produce all planar graphs with the given
|
@@ -2190,7 +2237,7 @@ class GraphGenerators:
|
|
2190
2237
|
|
2191
2238
|
if order == 1:
|
2192
2239
|
if minimum_degree == 0:
|
2193
|
-
G = graph.Graph(1)
|
2240
|
+
G = graph.Graph(1, immutable=immutable)
|
2194
2241
|
G.set_embedding({0: []})
|
2195
2242
|
yield G
|
2196
2243
|
return
|
@@ -2204,10 +2251,11 @@ class GraphGenerators:
|
|
2204
2251
|
edges, faces,
|
2205
2252
|
order)
|
2206
2253
|
|
2207
|
-
yield from graphs.plantri_gen(command)
|
2254
|
+
yield from graphs.plantri_gen(command, immutable=immutable)
|
2208
2255
|
|
2209
2256
|
def triangulations(self, order, minimum_degree=None, minimum_connectivity=None,
|
2210
|
-
exact_connectivity=False, only_eulerian=False, dual=False
|
2257
|
+
exact_connectivity=False, only_eulerian=False, dual=False,
|
2258
|
+
immutable=False):
|
2211
2259
|
r"""
|
2212
2260
|
An iterator over connected planar triangulations using the plantri generator.
|
2213
2261
|
|
@@ -2245,6 +2293,9 @@ class GraphGenerators:
|
|
2245
2293
|
- ``dual`` -- (default: ``False``) if ``True`` return instead the
|
2246
2294
|
planar duals of the generated graphs
|
2247
2295
|
|
2296
|
+
- ``immutable`` -- boolean (default: ``False``); whether to return
|
2297
|
+
immutable or mutable graphs
|
2298
|
+
|
2248
2299
|
OUTPUT:
|
2249
2300
|
|
2250
2301
|
An iterator which will produce all planar triangulations with the given
|
@@ -2390,10 +2441,11 @@ class GraphGenerators:
|
|
2390
2441
|
'd' if dual else '',
|
2391
2442
|
order)
|
2392
2443
|
|
2393
|
-
yield from graphs.plantri_gen(command)
|
2444
|
+
yield from graphs.plantri_gen(command, immutable=immutable)
|
2394
2445
|
|
2395
2446
|
def quadrangulations(self, order, minimum_degree=None, minimum_connectivity=None,
|
2396
|
-
no_nonfacial_quadrangles=False, dual=False
|
2447
|
+
no_nonfacial_quadrangles=False, dual=False,
|
2448
|
+
immutable=False):
|
2397
2449
|
r"""
|
2398
2450
|
An iterator over planar quadrangulations using the plantri generator.
|
2399
2451
|
|
@@ -2427,6 +2479,9 @@ class GraphGenerators:
|
|
2427
2479
|
- ``dual`` -- (default: ``False``) if ``True`` return instead the
|
2428
2480
|
planar duals of the generated graphs
|
2429
2481
|
|
2482
|
+
- ``immutable`` -- boolean (default: ``False``); whether to return
|
2483
|
+
immutable or mutable graphs
|
2484
|
+
|
2430
2485
|
OUTPUT:
|
2431
2486
|
|
2432
2487
|
An iterator which will produce all planar quadrangulations with the given
|
@@ -2525,7 +2580,7 @@ class GraphGenerators:
|
|
2525
2580
|
'd' if dual else '',
|
2526
2581
|
order)
|
2527
2582
|
|
2528
|
-
yield from graphs.plantri_gen(command)
|
2583
|
+
yield from graphs.plantri_gen(command, immutable=immutable)
|
2529
2584
|
|
2530
2585
|
###########################################################################
|
2531
2586
|
# Basic Graphs
|
Binary file
|
sage/graphs/graph_latex.py
CHANGED
@@ -1202,7 +1202,7 @@ class GraphLatex(SageObject):
|
|
1202
1202
|
raise TypeError('%s option must be a dictionary, not %s' % (name, value))
|
1203
1203
|
else:
|
1204
1204
|
for key, p in value.items():
|
1205
|
-
if not (
|
1205
|
+
if not (isinstance(p, (float, RealLiteral)) and (0 <= p <= 1)) and (p not in label_places):
|
1206
1206
|
raise ValueError('%s option for %s needs to be a number between 0.0 and 1.0 or a place (like "above"), not %s' % (name, key, p))
|
1207
1207
|
elif name == 'loop_placements':
|
1208
1208
|
if not isinstance(value, dict):
|
sage/graphs/graph_list.py
CHANGED
@@ -19,9 +19,6 @@ AUTHORS:
|
|
19
19
|
# ****************************************************************************
|
20
20
|
|
21
21
|
|
22
|
-
from sage.misc.misc import try_read
|
23
|
-
|
24
|
-
|
25
22
|
def from_whatever(data):
|
26
23
|
r"""
|
27
24
|
Return a list of Sage Graphs, given a list of whatever kind of data.
|
@@ -78,6 +75,8 @@ def _from_whatever(data, fmt=None):
|
|
78
75
|
if isinstance(data, str):
|
79
76
|
lines = data.splitlines()
|
80
77
|
else:
|
78
|
+
from sage.misc.misc import try_read
|
79
|
+
|
81
80
|
lines = try_read(data, splitlines=True)
|
82
81
|
|
83
82
|
if lines is not None and fmt is None:
|