passagemath-graphs 10.5.43__cp39-cp39-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.
Files changed (258) hide show
  1. passagemath_graphs-10.5.43.dist-info/METADATA +293 -0
  2. passagemath_graphs-10.5.43.dist-info/RECORD +258 -0
  3. passagemath_graphs-10.5.43.dist-info/WHEEL +5 -0
  4. passagemath_graphs-10.5.43.dist-info/top_level.txt +2 -0
  5. passagemath_graphs.libs/libgcc_s-69c45f16.so.1 +0 -0
  6. passagemath_graphs.libs/libgmp-8e78bd9b.so.10.5.0 +0 -0
  7. passagemath_graphs.libs/libstdc++-1f1a71be.so.6.0.33 +0 -0
  8. sage/all__sagemath_graphs.py +39 -0
  9. sage/combinat/abstract_tree.py +2552 -0
  10. sage/combinat/all__sagemath_graphs.py +34 -0
  11. sage/combinat/binary_tree.py +5306 -0
  12. sage/combinat/cluster_algebra_quiver/all.py +22 -0
  13. sage/combinat/cluster_algebra_quiver/cluster_seed.py +5208 -0
  14. sage/combinat/cluster_algebra_quiver/interact.py +125 -0
  15. sage/combinat/cluster_algebra_quiver/mutation_class.py +625 -0
  16. sage/combinat/cluster_algebra_quiver/mutation_type.py +1556 -0
  17. sage/combinat/cluster_algebra_quiver/quiver.py +2262 -0
  18. sage/combinat/cluster_algebra_quiver/quiver_mutation_type.py +2468 -0
  19. sage/combinat/designs/MOLS_handbook_data.py +570 -0
  20. sage/combinat/designs/all.py +58 -0
  21. sage/combinat/designs/bibd.py +1655 -0
  22. sage/combinat/designs/block_design.py +1071 -0
  23. sage/combinat/designs/covering_array.py +269 -0
  24. sage/combinat/designs/covering_design.py +534 -0
  25. sage/combinat/designs/database.py +5614 -0
  26. sage/combinat/designs/design_catalog.py +122 -0
  27. sage/combinat/designs/designs_pyx.cpython-39-aarch64-linux-gnu.so +0 -0
  28. sage/combinat/designs/designs_pyx.pxd +21 -0
  29. sage/combinat/designs/designs_pyx.pyx +993 -0
  30. sage/combinat/designs/difference_family.py +3951 -0
  31. sage/combinat/designs/difference_matrices.py +279 -0
  32. sage/combinat/designs/evenly_distributed_sets.cpython-39-aarch64-linux-gnu.so +0 -0
  33. sage/combinat/designs/evenly_distributed_sets.pyx +661 -0
  34. sage/combinat/designs/ext_rep.py +1064 -0
  35. sage/combinat/designs/gen_quadrangles_with_spread.cpython-39-aarch64-linux-gnu.so +0 -0
  36. sage/combinat/designs/gen_quadrangles_with_spread.pyx +339 -0
  37. sage/combinat/designs/group_divisible_designs.py +361 -0
  38. sage/combinat/designs/incidence_structures.py +2357 -0
  39. sage/combinat/designs/latin_squares.py +548 -0
  40. sage/combinat/designs/orthogonal_arrays.py +2243 -0
  41. sage/combinat/designs/orthogonal_arrays_build_recursive.py +1780 -0
  42. sage/combinat/designs/orthogonal_arrays_find_recursive.cpython-39-aarch64-linux-gnu.so +0 -0
  43. sage/combinat/designs/orthogonal_arrays_find_recursive.pyx +966 -0
  44. sage/combinat/designs/resolvable_bibd.py +781 -0
  45. sage/combinat/designs/steiner_quadruple_systems.py +1306 -0
  46. sage/combinat/designs/subhypergraph_search.cpython-39-aarch64-linux-gnu.so +0 -0
  47. sage/combinat/designs/subhypergraph_search.pyx +530 -0
  48. sage/combinat/designs/twographs.py +306 -0
  49. sage/combinat/finite_state_machine.py +14874 -0
  50. sage/combinat/finite_state_machine_generators.py +2006 -0
  51. sage/combinat/graph_path.py +448 -0
  52. sage/combinat/interval_posets.py +3908 -0
  53. sage/combinat/nu_tamari_lattice.py +269 -0
  54. sage/combinat/ordered_tree.py +1446 -0
  55. sage/combinat/posets/all.py +46 -0
  56. sage/combinat/posets/cartesian_product.py +493 -0
  57. sage/combinat/posets/d_complete.py +182 -0
  58. sage/combinat/posets/elements.py +273 -0
  59. sage/combinat/posets/forest.py +30 -0
  60. sage/combinat/posets/hasse_cython.cpython-39-aarch64-linux-gnu.so +0 -0
  61. sage/combinat/posets/hasse_cython.pyx +174 -0
  62. sage/combinat/posets/hasse_diagram.py +3678 -0
  63. sage/combinat/posets/incidence_algebras.py +796 -0
  64. sage/combinat/posets/lattices.py +5119 -0
  65. sage/combinat/posets/linear_extension_iterator.cpython-39-aarch64-linux-gnu.so +0 -0
  66. sage/combinat/posets/linear_extension_iterator.pyx +292 -0
  67. sage/combinat/posets/linear_extensions.py +1039 -0
  68. sage/combinat/posets/mobile.py +275 -0
  69. sage/combinat/posets/moebius_algebra.py +776 -0
  70. sage/combinat/posets/poset_examples.py +2131 -0
  71. sage/combinat/posets/posets.py +9169 -0
  72. sage/combinat/rooted_tree.py +1070 -0
  73. sage/combinat/shard_order.py +239 -0
  74. sage/combinat/tamari_lattices.py +384 -0
  75. sage/combinat/yang_baxter_graph.py +923 -0
  76. sage/databases/all__sagemath_graphs.py +1 -0
  77. sage/databases/knotinfo_db.py +1230 -0
  78. sage/ext_data/all__sagemath_graphs.py +1 -0
  79. sage/ext_data/graphs/graph_plot_js.html +330 -0
  80. sage/ext_data/kenzo/CP2.txt +45 -0
  81. sage/ext_data/kenzo/CP3.txt +349 -0
  82. sage/ext_data/kenzo/CP4.txt +4774 -0
  83. sage/ext_data/kenzo/README.txt +49 -0
  84. sage/ext_data/kenzo/S4.txt +20 -0
  85. sage/graphs/all.py +42 -0
  86. sage/graphs/asteroidal_triples.cpython-39-aarch64-linux-gnu.so +0 -0
  87. sage/graphs/asteroidal_triples.pyx +299 -0
  88. sage/graphs/base/all.py +1 -0
  89. sage/graphs/base/boost_graph.cpython-39-aarch64-linux-gnu.so +0 -0
  90. sage/graphs/base/boost_graph.pxd +106 -0
  91. sage/graphs/base/boost_graph.pyx +3045 -0
  92. sage/graphs/base/c_graph.cpython-39-aarch64-linux-gnu.so +0 -0
  93. sage/graphs/base/c_graph.pxd +106 -0
  94. sage/graphs/base/c_graph.pyx +5096 -0
  95. sage/graphs/base/dense_graph.cpython-39-aarch64-linux-gnu.so +0 -0
  96. sage/graphs/base/dense_graph.pxd +26 -0
  97. sage/graphs/base/dense_graph.pyx +757 -0
  98. sage/graphs/base/graph_backends.cpython-39-aarch64-linux-gnu.so +0 -0
  99. sage/graphs/base/graph_backends.pxd +5 -0
  100. sage/graphs/base/graph_backends.pyx +797 -0
  101. sage/graphs/base/overview.py +85 -0
  102. sage/graphs/base/sparse_graph.cpython-39-aarch64-linux-gnu.so +0 -0
  103. sage/graphs/base/sparse_graph.pxd +90 -0
  104. sage/graphs/base/sparse_graph.pyx +1653 -0
  105. sage/graphs/base/static_dense_graph.cpython-39-aarch64-linux-gnu.so +0 -0
  106. sage/graphs/base/static_dense_graph.pxd +5 -0
  107. sage/graphs/base/static_dense_graph.pyx +1032 -0
  108. sage/graphs/base/static_sparse_backend.cpython-39-aarch64-linux-gnu.so +0 -0
  109. sage/graphs/base/static_sparse_backend.pxd +27 -0
  110. sage/graphs/base/static_sparse_backend.pyx +1580 -0
  111. sage/graphs/base/static_sparse_graph.cpython-39-aarch64-linux-gnu.so +0 -0
  112. sage/graphs/base/static_sparse_graph.pxd +37 -0
  113. sage/graphs/base/static_sparse_graph.pyx +1304 -0
  114. sage/graphs/bipartite_graph.py +2709 -0
  115. sage/graphs/centrality.cpython-39-aarch64-linux-gnu.so +0 -0
  116. sage/graphs/centrality.pyx +965 -0
  117. sage/graphs/cographs.py +519 -0
  118. sage/graphs/comparability.cpython-39-aarch64-linux-gnu.so +0 -0
  119. sage/graphs/comparability.pyx +813 -0
  120. sage/graphs/connectivity.cpython-39-aarch64-linux-gnu.so +0 -0
  121. sage/graphs/connectivity.pxd +157 -0
  122. sage/graphs/connectivity.pyx +4813 -0
  123. sage/graphs/convexity_properties.cpython-39-aarch64-linux-gnu.so +0 -0
  124. sage/graphs/convexity_properties.pxd +16 -0
  125. sage/graphs/convexity_properties.pyx +827 -0
  126. sage/graphs/digraph.py +4410 -0
  127. sage/graphs/digraph_generators.py +1921 -0
  128. sage/graphs/distances_all_pairs.cpython-39-aarch64-linux-gnu.so +0 -0
  129. sage/graphs/distances_all_pairs.pxd +12 -0
  130. sage/graphs/distances_all_pairs.pyx +2938 -0
  131. sage/graphs/domination.py +1363 -0
  132. sage/graphs/dot2tex_utils.py +100 -0
  133. sage/graphs/edge_connectivity.cpython-39-aarch64-linux-gnu.so +0 -0
  134. sage/graphs/edge_connectivity.pyx +1215 -0
  135. sage/graphs/generators/all.py +1 -0
  136. sage/graphs/generators/basic.py +1769 -0
  137. sage/graphs/generators/chessboard.py +538 -0
  138. sage/graphs/generators/classical_geometries.py +1611 -0
  139. sage/graphs/generators/degree_sequence.py +235 -0
  140. sage/graphs/generators/distance_regular.cpython-39-aarch64-linux-gnu.so +0 -0
  141. sage/graphs/generators/distance_regular.pyx +2846 -0
  142. sage/graphs/generators/families.py +4749 -0
  143. sage/graphs/generators/intersection.py +565 -0
  144. sage/graphs/generators/platonic_solids.py +262 -0
  145. sage/graphs/generators/random.py +2623 -0
  146. sage/graphs/generators/smallgraphs.py +5741 -0
  147. sage/graphs/generators/world_map.py +724 -0
  148. sage/graphs/generic_graph.py +26395 -0
  149. sage/graphs/generic_graph_pyx.cpython-39-aarch64-linux-gnu.so +0 -0
  150. sage/graphs/generic_graph_pyx.pxd +34 -0
  151. sage/graphs/generic_graph_pyx.pyx +1626 -0
  152. sage/graphs/genus.cpython-39-aarch64-linux-gnu.so +0 -0
  153. sage/graphs/genus.pyx +623 -0
  154. sage/graphs/graph.py +9362 -0
  155. sage/graphs/graph_coloring.cpython-39-aarch64-linux-gnu.so +0 -0
  156. sage/graphs/graph_coloring.pyx +2284 -0
  157. sage/graphs/graph_database.py +1122 -0
  158. sage/graphs/graph_decompositions/all.py +1 -0
  159. sage/graphs/graph_decompositions/bandwidth.cpython-39-aarch64-linux-gnu.so +0 -0
  160. sage/graphs/graph_decompositions/bandwidth.pyx +428 -0
  161. sage/graphs/graph_decompositions/clique_separators.cpython-39-aarch64-linux-gnu.so +0 -0
  162. sage/graphs/graph_decompositions/clique_separators.pyx +595 -0
  163. sage/graphs/graph_decompositions/cutwidth.cpython-39-aarch64-linux-gnu.so +0 -0
  164. sage/graphs/graph_decompositions/cutwidth.pyx +753 -0
  165. sage/graphs/graph_decompositions/fast_digraph.cpython-39-aarch64-linux-gnu.so +0 -0
  166. sage/graphs/graph_decompositions/fast_digraph.pxd +13 -0
  167. sage/graphs/graph_decompositions/fast_digraph.pyx +212 -0
  168. sage/graphs/graph_decompositions/graph_products.cpython-39-aarch64-linux-gnu.so +0 -0
  169. sage/graphs/graph_decompositions/graph_products.pyx +462 -0
  170. sage/graphs/graph_decompositions/modular_decomposition.cpython-39-aarch64-linux-gnu.so +0 -0
  171. sage/graphs/graph_decompositions/modular_decomposition.pxd +27 -0
  172. sage/graphs/graph_decompositions/modular_decomposition.pyx +1536 -0
  173. sage/graphs/graph_decompositions/slice_decomposition.cpython-39-aarch64-linux-gnu.so +0 -0
  174. sage/graphs/graph_decompositions/slice_decomposition.pxd +18 -0
  175. sage/graphs/graph_decompositions/slice_decomposition.pyx +1080 -0
  176. sage/graphs/graph_decompositions/tree_decomposition.cpython-39-aarch64-linux-gnu.so +0 -0
  177. sage/graphs/graph_decompositions/tree_decomposition.pxd +17 -0
  178. sage/graphs/graph_decompositions/tree_decomposition.pyx +1996 -0
  179. sage/graphs/graph_decompositions/vertex_separation.cpython-39-aarch64-linux-gnu.so +0 -0
  180. sage/graphs/graph_decompositions/vertex_separation.pxd +5 -0
  181. sage/graphs/graph_decompositions/vertex_separation.pyx +1963 -0
  182. sage/graphs/graph_editor.py +82 -0
  183. sage/graphs/graph_generators.py +3301 -0
  184. sage/graphs/graph_generators_pyx.cpython-39-aarch64-linux-gnu.so +0 -0
  185. sage/graphs/graph_generators_pyx.pyx +95 -0
  186. sage/graphs/graph_input.py +812 -0
  187. sage/graphs/graph_latex.py +2064 -0
  188. sage/graphs/graph_list.py +367 -0
  189. sage/graphs/graph_plot.py +1749 -0
  190. sage/graphs/graph_plot_js.py +338 -0
  191. sage/graphs/hyperbolicity.cpython-39-aarch64-linux-gnu.so +0 -0
  192. sage/graphs/hyperbolicity.pyx +1702 -0
  193. sage/graphs/hypergraph_generators.py +364 -0
  194. sage/graphs/independent_sets.cpython-39-aarch64-linux-gnu.so +0 -0
  195. sage/graphs/independent_sets.pxd +13 -0
  196. sage/graphs/independent_sets.pyx +402 -0
  197. sage/graphs/isgci.py +1033 -0
  198. sage/graphs/isoperimetric_inequalities.cpython-39-aarch64-linux-gnu.so +0 -0
  199. sage/graphs/isoperimetric_inequalities.pyx +453 -0
  200. sage/graphs/line_graph.cpython-39-aarch64-linux-gnu.so +0 -0
  201. sage/graphs/line_graph.pyx +627 -0
  202. sage/graphs/lovasz_theta.py +77 -0
  203. sage/graphs/matching.py +1633 -0
  204. sage/graphs/matching_covered_graph.py +3566 -0
  205. sage/graphs/orientations.py +1504 -0
  206. sage/graphs/partial_cube.py +459 -0
  207. sage/graphs/path_enumeration.cpython-39-aarch64-linux-gnu.so +0 -0
  208. sage/graphs/path_enumeration.pyx +2040 -0
  209. sage/graphs/pq_trees.py +1129 -0
  210. sage/graphs/print_graphs.py +201 -0
  211. sage/graphs/schnyder.py +865 -0
  212. sage/graphs/spanning_tree.cpython-39-aarch64-linux-gnu.so +0 -0
  213. sage/graphs/spanning_tree.pyx +1457 -0
  214. sage/graphs/strongly_regular_db.cpython-39-aarch64-linux-gnu.so +0 -0
  215. sage/graphs/strongly_regular_db.pyx +3340 -0
  216. sage/graphs/traversals.cpython-39-aarch64-linux-gnu.so +0 -0
  217. sage/graphs/traversals.pxd +9 -0
  218. sage/graphs/traversals.pyx +1871 -0
  219. sage/graphs/trees.cpython-39-aarch64-linux-gnu.so +0 -0
  220. sage/graphs/trees.pxd +15 -0
  221. sage/graphs/trees.pyx +310 -0
  222. sage/graphs/tutte_polynomial.py +713 -0
  223. sage/graphs/views.cpython-39-aarch64-linux-gnu.so +0 -0
  224. sage/graphs/views.pyx +794 -0
  225. sage/graphs/weakly_chordal.cpython-39-aarch64-linux-gnu.so +0 -0
  226. sage/graphs/weakly_chordal.pyx +562 -0
  227. sage/groups/all__sagemath_graphs.py +1 -0
  228. sage/groups/perm_gps/all__sagemath_graphs.py +1 -0
  229. sage/groups/perm_gps/partn_ref/all__sagemath_graphs.py +1 -0
  230. sage/groups/perm_gps/partn_ref/refinement_graphs.cpython-39-aarch64-linux-gnu.so +0 -0
  231. sage/groups/perm_gps/partn_ref/refinement_graphs.pxd +38 -0
  232. sage/groups/perm_gps/partn_ref/refinement_graphs.pyx +1666 -0
  233. sage/knots/all.py +6 -0
  234. sage/knots/free_knotinfo_monoid.py +507 -0
  235. sage/knots/gauss_code.py +291 -0
  236. sage/knots/knot.py +682 -0
  237. sage/knots/knot_table.py +284 -0
  238. sage/knots/knotinfo.py +2880 -0
  239. sage/knots/link.py +4682 -0
  240. sage/sandpiles/all.py +13 -0
  241. sage/sandpiles/examples.py +225 -0
  242. sage/sandpiles/sandpile.py +6365 -0
  243. sage/topology/all.py +22 -0
  244. sage/topology/cell_complex.py +1214 -0
  245. sage/topology/cubical_complex.py +1977 -0
  246. sage/topology/delta_complex.py +1806 -0
  247. sage/topology/filtered_simplicial_complex.py +744 -0
  248. sage/topology/moment_angle_complex.py +823 -0
  249. sage/topology/simplicial_complex.py +5161 -0
  250. sage/topology/simplicial_complex_catalog.py +86 -0
  251. sage/topology/simplicial_complex_examples.py +1692 -0
  252. sage/topology/simplicial_complex_homset.py +205 -0
  253. sage/topology/simplicial_complex_morphism.py +836 -0
  254. sage/topology/simplicial_set.py +4102 -0
  255. sage/topology/simplicial_set_catalog.py +55 -0
  256. sage/topology/simplicial_set_constructions.py +2954 -0
  257. sage/topology/simplicial_set_examples.py +865 -0
  258. sage/topology/simplicial_set_morphism.py +1464 -0
@@ -0,0 +1,367 @@
1
+ # sage_setup: distribution = sagemath-graphs
2
+ r"""
3
+ Lists of graphs
4
+
5
+ AUTHORS:
6
+
7
+ - Robert L. Miller (2007-02-10): initial version
8
+
9
+ - Emily A. Kirkman (2007-02-13): added show functions
10
+ (to_graphics_array and show_graphs)
11
+ """
12
+
13
+ # ****************************************************************************
14
+ # Copyright (C) 2007 Robert L. Miller <rlmillster@gmail.com>
15
+ # and Emily A. Kirkman
16
+ #
17
+ # Distributed under the terms of the GNU General Public License (GPL)
18
+ # http://www.gnu.org/licenses/
19
+ # ****************************************************************************
20
+
21
+
22
+ def from_whatever(data):
23
+ r"""
24
+ Return a list of Sage Graphs, given a list of whatever kind of data.
25
+
26
+ INPUT:
27
+
28
+ - ``data`` -- can be a string, a list/iterable of strings, or a readable
29
+ file-like object
30
+
31
+ EXAMPLES::
32
+
33
+ sage: l = ['N@@?N@UGAGG?gGlKCMO', ':P_`cBaC_ACd`C_@BC`ABDHaEH_@BF_@CHIK_@BCEHKL_BIKM_BFGHI']
34
+ sage: graphs_list.from_whatever(l)
35
+ [Graph on 15 vertices, Looped multi-graph on 17 vertices]
36
+ sage: graphs_list.from_whatever('\n'.join(l))
37
+ [Graph on 15 vertices, Looped multi-graph on 17 vertices]
38
+
39
+ This example happens to be a mix a sparse and non-sparse graphs, so we don't
40
+ explicitly put a ``.g6`` or ``.s6`` extension, which implies just one or the
41
+ other::
42
+
43
+ sage: filename = tmp_filename()
44
+ sage: with open(filename, 'w') as fobj:
45
+ ....: _ = fobj.write('\n'.join(l))
46
+ sage: with open(filename) as fobj:
47
+ ....: graphs_list.from_whatever(fobj)
48
+ [Graph on 15 vertices, Looped multi-graph on 17 vertices]
49
+ """
50
+ return _from_whatever(data)
51
+
52
+
53
+ def _from_whatever(data, fmt=None):
54
+ """
55
+ Implementation details of :func:`from_whatever`.
56
+
57
+ INPUT:
58
+
59
+ - ``data`` -- can be a string, a list/iterable of strings, or a readable
60
+ file-like object
61
+
62
+ - ``fmt`` -- string (default: ``None``); format of ``data``. It can be
63
+ either ``'graph6'``, ``sparse6``, or ``None``, with the latter case
64
+ indicating that the ``Graph`` constructor should determine this for
65
+ itself
66
+
67
+ EXAMPLES::
68
+
69
+ sage: l = ['N@@?N@UGAGG?gGlKCMO', ':P_`cBaC_ACd`C_@BC`ABDHaEH_@BF_@CHIK_@BCEHKL_BIKM_BFGHI']
70
+ sage: graphs_list.from_whatever(l)
71
+ [Graph on 15 vertices, Looped multi-graph on 17 vertices]
72
+ """
73
+ from sage.graphs.graph import Graph
74
+
75
+ if isinstance(data, str):
76
+ lines = data.splitlines()
77
+ else:
78
+ from sage.misc.misc import try_read
79
+
80
+ lines = try_read(data, splitlines=True)
81
+
82
+ if lines is not None and fmt is None:
83
+ # In this case the format should be 'forced' by the filename
84
+ if hasattr(data, 'name'):
85
+ if data.name.endswith('.g6'):
86
+ fmt = 'graph6'
87
+ elif data.name.endswith('.s6'):
88
+ fmt = 'sparse6'
89
+ else:
90
+ try:
91
+ lines = iter(data)
92
+ except TypeError:
93
+ raise TypeError(
94
+ "must be a string, an iterable of strings, or a readable "
95
+ "file-like object")
96
+
97
+ if fmt == 'graph6':
98
+ kwargs = {'format': fmt}
99
+ elif fmt == 'sparse6':
100
+ kwargs = {'format': fmt, 'sparse': True} # probably implied?
101
+ else:
102
+ kwargs = {} # We let Graph guess
103
+
104
+ out = []
105
+ for line in lines:
106
+ if not isinstance(line, str):
107
+ raise TypeError("must be an iterable of strings")
108
+ line = line.strip()
109
+ if not line:
110
+ continue
111
+
112
+ if '\n' in line:
113
+ out.append(_from_whatever(line.splitlines(), fmt=fmt))
114
+ else:
115
+ out.append(Graph(line, **kwargs))
116
+
117
+ return out
118
+
119
+
120
+ def from_graph6(data):
121
+ """
122
+ Return a list of Sage Graphs, given a list of graph6 data.
123
+
124
+ INPUT:
125
+
126
+ - ``data`` -- can be a string, a list of strings, or a file stream
127
+
128
+ EXAMPLES::
129
+
130
+ sage: l = ['N@@?N@UGAGG?gGlKCMO', 'XsGGWOW?CC?C@HQKHqOjYKC_uHWGX?P?~TqIKA`OA@SAOEcEA??']
131
+ sage: graphs_list.from_graph6(l)
132
+ [Graph on 15 vertices, Graph on 25 vertices]
133
+ """
134
+ return _from_whatever(data, fmt='graph6')
135
+
136
+
137
+ def from_sparse6(data):
138
+ """
139
+ Return a list of Sage Graphs, given a list of sparse6 data.
140
+
141
+ INPUT:
142
+
143
+ - ``data`` -- can be a string, a list of strings, or a file stream
144
+
145
+ EXAMPLES::
146
+
147
+ sage: g1 = ':P_`cBaC_ACd`C_@BC`ABDHaEH_@BF_@CHIK_@BCEHKL_BIKM_BFGHI'
148
+ sage: g2 = ':f`??KO?B_OOSCGE_?OWONDBO?GOJBDO?_SSJdApcOIG`?og_UKEbg?_SKF'
149
+ sage: g2 += 'q@[CCBA`p?oYMFp@gw]Qaa@xEMHDb@hMCBCbQ@ECHEcAKKQKFPOwo[PIDQ'
150
+ sage: g2 += '{KIHEcQPOkVKEW_WMNKqPWwcRKOOWSKIGCqhWt??___WMJFCahWzEBa`xO'
151
+ sage: g2 += 'u[MpPPKqYNoOOOKHHDBPs|??__gWMKEcAHKgTLErqA?A@a@G{kVLErs?GD'
152
+ sage: g2 += 'BA@XCs\\NggWSOJIDbHh@?A@aF'
153
+ sage: graphs_list.from_sparse6([g1, g2])
154
+ [Looped multi-graph on 17 vertices, Looped multi-graph on 39 vertices]
155
+ """
156
+ return _from_whatever(data, fmt='sparse6')
157
+
158
+
159
+ def to_graph6(graphs, file=None, output_list=False):
160
+ r"""
161
+ Convert a list of Sage graphs to a single string of graph6 graphs.
162
+
163
+ If ``file`` is specified, then the string will be written quietly to the
164
+ file. If ``output_list`` is ``True``, then a list of strings will be
165
+ returned, one string per graph.
166
+
167
+ INPUT:
168
+
169
+ - ``graphs`` -- a Python list of Sage Graphs
170
+
171
+ - ``file`` -- (optional) a file stream to write to (must be in 'w' mode)
172
+
173
+ - ``output_list`` -- boolean (default: ``False``); whether to return a
174
+ string (when set to ``True``) or a list of strings. This parameter is
175
+ ignored if file gets specified
176
+
177
+ EXAMPLES::
178
+
179
+ sage: l = [graphs.DodecahedralGraph(), graphs.PetersenGraph()]
180
+ sage: graphs_list.to_graph6(l)
181
+ 'ShCHGD@?K?_@?@?C_GGG@??cG?G?GK_?C\nIheA@GUAo\n'
182
+ """
183
+ return _to_graph6(graphs, file=file, output_list=output_list)
184
+
185
+
186
+ def to_sparse6(graphs, file=None, output_list=False):
187
+ r"""
188
+ Convert a list of Sage graphs to a single string of sparse6 graphs.
189
+
190
+ If ``file`` is specified, then the string will be written quietly to the
191
+ file. If ``output_list`` is ``True``, then a list of strings will be
192
+ returned, one string per graph.
193
+
194
+ INPUT:
195
+
196
+ - ``graphs`` -- a Python list of Sage Graphs
197
+
198
+ - ``file`` -- (optional) a file stream to write to (must be in 'w' mode)
199
+
200
+ - ``output_list`` -- boolean (default: ``False``); whether to return a
201
+ string (when set to ``True``) or a list of strings. This parameter is
202
+ ignored if file gets specified
203
+
204
+ EXAMPLES::
205
+
206
+ sage: l = [graphs.DodecahedralGraph(), graphs.PetersenGraph()]
207
+ sage: graphs_list.to_sparse6(l)
208
+ ':S_`abcaDe`Fg_HijhKfLdMkNcOjP_BQ\n:I`ES@obGkqegW~\n'
209
+ """
210
+ return _to_graph6(graphs, file=file, output_list=output_list, sparse=True)
211
+
212
+
213
+ def _to_graph6(graphs, file=None, output_list=False, sparse=False):
214
+ r"""
215
+ Internal implementation of :func:`to_graph6` and :func:`to_sparse6`.
216
+
217
+ EXAMPLES::
218
+
219
+ sage: l = [graphs.DodecahedralGraph(), graphs.PetersenGraph()]
220
+ sage: graphs_list._to_graph6(l, sparse=False)
221
+ 'ShCHGD@?K?_@?@?C_GGG@??cG?G?GK_?C\nIheA@GUAo\n'
222
+ sage: graphs_list._to_graph6(l, sparse=True)
223
+ ':S_`abcaDe`Fg_HijhKfLdMkNcOjP_BQ\n:I`ES@obGkqegW~\n'
224
+ """
225
+ if sparse:
226
+ method = 'sparse6_string'
227
+ else:
228
+ method = 'graph6_string'
229
+
230
+ strs = [getattr(g, method)() for g in graphs]
231
+
232
+ if file or not output_list:
233
+ strs = '\n'.join(strs) + '\n'
234
+
235
+ if file is None:
236
+ return strs
237
+
238
+ file.write(strs)
239
+ file.flush()
240
+
241
+
242
+ def to_graphics_array(graph_list, **kwds):
243
+ """
244
+ Draw all graphs in a graphics array.
245
+
246
+ INPUT:
247
+
248
+ - ``graph_list`` -- a Python list of Sage Graphs
249
+
250
+ GRAPH PLOTTING:
251
+
252
+ Defaults to circular layout for graphs. This allows for a nicer display in a
253
+ small area and takes much less time to compute than the spring- layout
254
+ algorithm for many graphs.
255
+
256
+ EXAMPLES::
257
+
258
+ sage: glist = []
259
+ sage: for i in range(999):
260
+ ....: glist.append(graphs.RandomGNP(6, .45))
261
+ sage: garray = graphs_list.to_graphics_array(glist) # needs sage.plot
262
+ sage: garray.nrows(), garray.ncols() # needs sage.plot
263
+ (250, 4)
264
+
265
+ See the .plot() or .show() documentation for an individual graph for
266
+ options, all of which are available from :func:`to_graphics_array`::
267
+
268
+ sage: glist = []
269
+ sage: for _ in range(10): # needs networkx
270
+ ....: glist.append(graphs.RandomLobster(41, .3, .4))
271
+ sage: graphs_list.to_graphics_array(glist, layout='spring', vertex_size=20) # needs networkx sage.plot
272
+ Graphics Array of size 3 x 4
273
+ """
274
+ from sage.graphs import graph
275
+ plist = []
276
+ for graph_i in graph_list:
277
+ if isinstance(graph_i, graph.GenericGraph):
278
+ pos = graph_i.get_pos()
279
+ if pos is None:
280
+ if 'layout' not in kwds:
281
+ kwds['layout'] = 'circular'
282
+ if 'vertex_size' not in kwds:
283
+ kwds['vertex_size'] = 50
284
+ if 'vertex_labels' not in kwds:
285
+ kwds['vertex_labels'] = False
286
+ kwds['graph_border'] = True
287
+ plist.append(graph_i.plot(**kwds))
288
+ else:
289
+ plist.append(graph_i.plot(pos=pos, vertex_size=50,
290
+ vertex_labels=False,
291
+ graph_border=True))
292
+ else:
293
+ raise TypeError('param list must be a list of Sage (di)graphs.')
294
+ from sage.plot.plot import graphics_array
295
+ return graphics_array(plist, ncols=4)
296
+
297
+
298
+ def show_graphs(graph_list, **kwds):
299
+ """
300
+ Show a maximum of 20 graphs from ``graph_list`` in a sage graphics array.
301
+
302
+ If more than 20 graphs are given in the list argument, then it will display
303
+ one graphics array after another with each containing at most 20 graphs.
304
+
305
+ Note that to save the image output from the notebook, you must save each
306
+ graphics array individually. (There will be a small space between graphics
307
+ arrays).
308
+
309
+ INPUT:
310
+
311
+ - ``graph_list`` -- a Python list of Sage Graphs
312
+
313
+ GRAPH PLOTTING: Defaults to circular layout for graphs. This allows for a
314
+ nicer display in a small area and takes much less time to compute than the
315
+ spring-layout algorithm for many graphs.
316
+
317
+ EXAMPLES: Create a list of graphs::
318
+
319
+ sage: glist = []
320
+ sage: glist.append(graphs.CompleteGraph(6))
321
+ sage: glist.append(graphs.CompleteBipartiteGraph(4, 5))
322
+ sage: glist.append(graphs.BarbellGraph(7, 4))
323
+ sage: glist.append(graphs.CycleGraph(15))
324
+ sage: glist.append(graphs.DiamondGraph())
325
+ sage: glist.append(graphs.GemGraph())
326
+ sage: glist.append(graphs.DartGraph())
327
+ sage: glist.append(graphs.ForkGraph())
328
+ sage: glist.append(graphs.HouseGraph())
329
+ sage: glist.append(graphs.HouseXGraph())
330
+ sage: glist.append(graphs.KrackhardtKiteGraph())
331
+ sage: glist.append(graphs.LadderGraph(5))
332
+ sage: glist.append(graphs.LollipopGraph(5, 6))
333
+ sage: glist.append(graphs.PathGraph(15))
334
+ sage: glist.append(graphs.PetersenGraph())
335
+ sage: glist.append(graphs.StarGraph(17))
336
+ sage: glist.append(graphs.WheelGraph(9))
337
+
338
+ Check that length is <= 20::
339
+
340
+ sage: len(glist)
341
+ 17
342
+
343
+ Show the graphs in a graphics array::
344
+
345
+ sage: graphs_list.show_graphs(glist) # needs sage.plot
346
+
347
+ Example where more than one graphics array is used::
348
+
349
+ sage: # needs database_graphs
350
+ sage: gq = GraphQuery(display_cols=['graph6'], num_vertices=5)
351
+ sage: g = gq.get_graphs_list()
352
+ sage: len(g)
353
+ 34
354
+ sage: graphs_list.show_graphs(g) # needs sage.plot
355
+
356
+ See the .plot() or .show() documentation for an individual graph for
357
+ options, all of which are available from :func:`to_graphics_array`::
358
+
359
+ sage: glist = []
360
+ sage: for _ in range(10): # needs networkx
361
+ ....: glist.append(graphs.RandomLobster(41, .3, .4))
362
+ sage: graphs_list.show_graphs(glist, layout='spring', vertex_size=20) # needs sage.plot
363
+ """
364
+ graph_list = list(graph_list)
365
+ for i in range(len(graph_list) // 20 + 1):
366
+ graph_slice = graph_list[20 * i: 20 * (i + 1)]
367
+ to_graphics_array(graph_slice, **kwds).show()