Skip to content

Commit

Permalink
sage.graphs: More # optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed May 17, 2023
1 parent f2f5863 commit 7f8de83
Show file tree
Hide file tree
Showing 23 changed files with 476 additions and 429 deletions.
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 7f8de83

Please sign in to comment.