Skip to content

Commit

Permalink
gh-35647: sage.graphs: More # optional and other modularization fixes
Browse files Browse the repository at this point in the history
<!-- Please provide a concise, informative and self-explanatory title.
-->
<!-- Don't put issue numbers in the title. Put it in the Description
below. -->
<!-- For example, instead of "Fixes #12345", use "Add a new method to
multiply two integers" -->

### 📚 Description

<!-- Describe your changes here in detail. -->
<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes #12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->
Part of:
- #29705

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. It should be `[x]` not `[x
]`. -->

- [x] The title is concise, informative, and self-explanatory.
- [ ] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- #12345: short description why this is a dependency
- #34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

URL: #35647
Reported by: Matthias Köppe
Reviewer(s): David Coudert
  • Loading branch information
Release Manager committed May 27, 2023
2 parents 3b9d676 + 979420d commit 21e8f9f
Show file tree
Hide file tree
Showing 25 changed files with 479 additions and 432 deletions.
6 changes: 3 additions & 3 deletions build/pkgs/configure/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tarball=configure-VERSION.tar.gz
sha1=e55fd192510499ab59847906bf0abc0e1776aecb
md5=7adfc7ea92837b419c9cf91085b4c0c2
cksum=2479564476
sha1=1ef3ccb4e221787756f5d865edd4883d6e8a2aab
md5=f7ca42afb156ba5aa99de96f825948b7
cksum=3849472062
2 changes: 1 addition & 1 deletion build/pkgs/configure/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8455792fc708dc9b848e9d084e96a6a890bca822
111d02b0cbc6552b1650930728c7084a72f88a73
2 changes: 1 addition & 1 deletion src/sage/graphs/base/c_graph.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4548,7 +4548,7 @@ cdef class CGraphBackend(GenericGraphBackend):
At first, the following graph is acyclic::
sage: D = DiGraph({ 0:[1,2,3], 4:[2,5], 1:[8], 2:[7], 3:[7], 5:[6,7], 7:[8], 6:[9], 8:[10], 9:[10] })
sage: D.plot(layout='circular').show()
sage: D.plot(layout='circular').show() # optional - sage.plot
sage: D.is_directed_acyclic()
True
Expand Down
14 changes: 7 additions & 7 deletions src/sage/graphs/bipartite_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class BipartiteGraph(Graph):
sage: B = BipartiteGraph(P, partition, check=False)
sage: B.left
{0, 1, 2, 3, 4}
sage: B.show()
sage: B.show() # optional - sage.plot
::
Expand Down Expand Up @@ -304,14 +304,14 @@ class BipartiteGraph(Graph):
sage: B = BipartiteGraph('F?^T_\n', partition=[[0, 1, 2], [3, 4, 5, 6]], check=False)
sage: B.left
{0, 1, 2}
sage: B.show()
sage: B.show() # optional - sage.plot
#. From a NetworkX bipartite graph::
sage: import networkx # optional - networkx
sage: G = graphs.OctahedralGraph() # optional - networkx
sage: N = networkx.make_clique_bipartite(G.networkx_graph()) # optional - networkx
sage: B = BipartiteGraph(N) # optional - networkx
sage: import networkx # optional - networkx
sage: G = graphs.OctahedralGraph() # optional - networkx
sage: N = networkx.make_clique_bipartite(G.networkx_graph()) # optional - networkx
sage: B = BipartiteGraph(N) # optional - networkx
TESTS:
Expand Down Expand Up @@ -1464,7 +1464,7 @@ def plot(self, *args, **kwds):
EXAMPLES::
sage: B = BipartiteGraph(graphs.CycleGraph(20))
sage: B.plot()
sage: B.plot() # optional - sage.plot
Graphics object consisting of 41 graphics primitives
"""
if "pos" not in kwds:
Expand Down
4 changes: 2 additions & 2 deletions src/sage/graphs/cliquer.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def all_max_clique(graph):
[2, 6], [2, 8], [3, 4], [3, 7], [3, 9], [4, 5], [4, 8], [5, 10],
[5, 11], [6, 10], [6, 11], [7, 8], [7, 11], [8, 10], [9, 10], [9, 11]]
sage: G = Graph({0:[1,2,3], 1:[2], 3:[0,1]})
sage: G.show(figsize=[2,2])
sage: G.show(figsize=[2,2]) # optional - sage.plot
sage: G.cliques_maximum()
[[0, 1, 2], [0, 1, 3]]
sage: C = graphs.PetersenGraph()
Expand Down Expand Up @@ -302,7 +302,7 @@ def clique_number(graph):
sage: C.clique_number()
4
sage: G = Graph({0:[1,2,3], 1:[2], 3:[0,1]})
sage: G.show(figsize=[2,2])
sage: G.show(figsize=[2,2]) # optional - sage.plot
sage: G.clique_number()
3
Expand Down
2 changes: 1 addition & 1 deletion src/sage/graphs/comparability.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ def is_permutation(g, algorithm="greedy", certificate=False, check=True,
sage: p1 = Permutation([nn+1 for nn in perm[0]])
sage: p2 = Permutation([nn+1 for nn in perm[1]])
sage: p = p2 * p1.inverse()
sage: p.show(representation = "braid")
sage: p.show(representation="braid") # optional - sage.plot

TESTS:

Expand Down
6 changes: 3 additions & 3 deletions src/sage/graphs/connectivity.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,12 @@ def connected_components_subgraphs(G):
sage: from sage.graphs.connectivity import connected_components_subgraphs
sage: G = Graph({0: [1, 3], 1: [2], 2: [3], 4: [5, 6], 5: [6]})
sage: L = connected_components_subgraphs(G)
sage: graphs_list.show_graphs(L)
sage: graphs_list.show_graphs(L) # optional - sage.plot
sage: D = DiGraph({0: [1, 3], 1: [2], 2: [3], 4: [5, 6], 5: [6]})
sage: L = connected_components_subgraphs(D)
sage: graphs_list.show_graphs(L)
sage: graphs_list.show_graphs(L) # optional - sage.plot
sage: L = D.connected_components_subgraphs()
sage: graphs_list.show_graphs(L)
sage: graphs_list.show_graphs(L) # optional - sage.plot
TESTS:
Expand Down
6 changes: 3 additions & 3 deletions src/sage/graphs/digraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ def is_directed_acyclic(self, certificate=False):
At first, the following graph is acyclic::
sage: D = DiGraph({0:[1, 2, 3], 4:[2, 5], 1:[8], 2:[7], 3:[7], 5:[6,7], 7:[8], 6:[9], 8:[10], 9:[10]})
sage: D.plot(layout='circular').show()
sage: D.plot(layout='circular').show() # optional - sage.plot
sage: D.is_directed_acyclic()
True
Expand Down Expand Up @@ -3140,7 +3140,7 @@ def topological_sort(self, implementation="default"):
sage: D = DiGraph({0: [1, 2, 3], 4: [2, 5], 1: [8], 2: [7], 3: [7],
....: 5: [6, 7], 7: [8], 6: [9], 8: [10], 9: [10]})
sage: D.plot(layout='circular').show()
sage: D.plot(layout='circular').show() # optional - sage.plot
sage: D.topological_sort()
[4, 5, 6, 9, 0, 1, 2, 3, 7, 8, 10]
Expand Down Expand Up @@ -3220,7 +3220,7 @@ def topological_sort_generator(self):
EXAMPLES::
sage: D = DiGraph({0: [1, 2], 1: [3], 2: [3, 4]})
sage: D.plot(layout='circular').show()
sage: D.plot(layout='circular').show() # optional - sage.plot
sage: list(D.topological_sort_generator())
[[0, 1, 2, 3, 4], [0, 2, 1, 3, 4], [0, 2, 1, 4, 3], [0, 2, 4, 1, 3], [0, 1, 2, 4, 3]]
Expand Down
Loading

0 comments on commit 21e8f9f

Please sign in to comment.