Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit a9ecbc5

Browse files
committed
trac 22349: edge sorting
1 parent 1ec4bdf commit a9ecbc5

File tree

126 files changed

+695
-684
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+695
-684
lines changed

src/doc/en/prep/Quickstarts/Graphs-and-Discrete.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Edges can be labeled.
102102
::
103103

104104
sage: L=graphs.CycleGraph(5)
105-
sage: for edge in L.edges():
105+
sage: for edge in L.edges(sort=True):
106106
....: u = edge[0]
107107
....: v = edge[1]
108108
....: L.set_edge_label(u, v, u*v)

src/doc/en/thematic_tutorials/lie/affine_finite_crystals.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ up to a relabeling of the arrows::
356356
sage: G = K.digraph()
357357
sage: Gdual = Kdual.digraph()
358358
sage: f = { 1:1, 0:2, 2:0 }
359-
sage: for u,v,label in Gdual.edges():
359+
sage: for u,v,label in Gdual.edges(sort=False):
360360
....: Gdual.set_edge_label(u,v,f[label])
361361
sage: G.is_isomorphic(Gdual, edge_labels = True)
362362
True

src/doc/en/thematic_tutorials/linear_programming.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ Let us write the Sage code of this MILP::
331331
332332
::
333333

334-
sage: p.set_objective(p.sum(matching[e] for e in g.edges(labels=False)))
334+
sage: p.set_objective(p.sum(matching[e] for e in g.edges(sort=False, labels=False)))
335335

336336
.. link
337337
@@ -417,7 +417,7 @@ graph, in which all the edges have a capacity of 1::
417417
418418
::
419419

420-
sage: for e in g.edges(labels=False):
420+
sage: for e in g.edges(sort=False, labels=False):
421421
....: p.add_constraint(f[e] <= 1)
422422

423423
.. link

src/sage/categories/coxeter_groups.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def coxeter_diagram(self):
171171
sage: W = CoxeterGroup(['H',3], implementation="reflection")
172172
sage: G = W.coxeter_diagram(); G
173173
Graph on 3 vertices
174-
sage: G.edges()
174+
sage: G.edges(sort=True)
175175
[(1, 2, 3), (2, 3, 5)]
176176
sage: CoxeterGroup(G) is W
177177
True
@@ -1079,7 +1079,7 @@ def bruhat_graph(self, x=None, y=None, edge_labels=False):
10791079
Check that the graph has the correct number of edges
10801080
(see :trac:`17744`)::
10811081
1082-
sage: len(G.edges())
1082+
sage: len(G.edges(sort=False))
10831083
16
10841084
"""
10851085
if x is None or x == 1:
@@ -1682,9 +1682,9 @@ def reduced_word_graph(self):
16821682
16
16831683
sage: G.num_edges()
16841684
18
1685-
sage: len([e for e in G.edges() if e[2] == 2])
1685+
sage: len([e for e in G.edges(sort=False) if e[2] == 2])
16861686
10
1687-
sage: len([e for e in G.edges() if e[2] == 3])
1687+
sage: len([e for e in G.edges(sort=False) if e[2] == 3])
16881688
8
16891689
16901690
TESTS::

src/sage/categories/crystals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ def digraph(self, subset=None, index_set=None):
870870
871871
sage: C = crystals.KirillovReshetikhin(['D',4,1], 2, 1)
872872
sage: G = C.digraph(index_set=[1,3])
873-
sage: len(G.edges())
873+
sage: len(G.edges(sort=False))
874874
20
875875
sage: view(G) # optional - dot2tex graphviz, not tested (opens external window)
876876

src/sage/categories/examples/crystals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def e(self, i):
211211
[[1, 1, 0], [2, 1, 1], [3, 1, 2], [5, 1, 3], [4, 2, 0], [5, 2, 4]]
212212
"""
213213
assert i in self.index_set()
214-
for edge in self.parent().G.edges():
214+
for edge in self.parent().G.edges(sort=False):
215215
if edge[1] == int(str(self)) and edge[2] == i:
216216
return self.parent()(edge[0])
217217
return None

src/sage/categories/examples/finite_coxeter_groups.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class DihedralGroup(UniqueRepresentation, Parent):
7070
sage: TestSuite(G).run()
7171
7272
sage: c = FiniteCoxeterGroups().example(3).cayley_graph()
73-
sage: sorted(c.edges())
73+
sage: c.edges(sort=True)
7474
[((), (1,), 1),
7575
((), (2,), 2),
7676
((1,), (), 1),

src/sage/categories/finite_coxeter_groups.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ def weak_poset(self, side="right", facade=False):
431431
sage: W = WeylGroup(["A",2])
432432
sage: P = W.weak_poset(side = "twosided")
433433
sage: P.show()
434-
sage: len(P.hasse_diagram().edges())
434+
sage: len(P.hasse_diagram().edges(sort=False))
435435
8
436436
437437
This is the transitive closure of the union of left and
@@ -869,7 +869,7 @@ def coxeter_knuth_graph(self):
869869
(2, 1, 2, 3, 2),
870870
(2, 1, 3, 2, 3),
871871
(2, 3, 1, 2, 3)]
872-
sage: D.edges()
872+
sage: D.edges(sort=True)
873873
[((1, 2, 1, 3, 2), (1, 2, 3, 1, 2), None),
874874
((1, 2, 1, 3, 2), (2, 1, 2, 3, 2), None),
875875
((2, 1, 2, 3, 2), (2, 1, 3, 2, 3), None),
@@ -879,7 +879,7 @@ def coxeter_knuth_graph(self):
879879
sage: D = w.coxeter_knuth_graph()
880880
sage: D.vertices(sort=True)
881881
[(1, 3), (3, 1)]
882-
sage: D.edges()
882+
sage: D.edges(sort=False)
883883
[]
884884
885885
TESTS::

src/sage/categories/regular_crystals.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,10 @@ def demazure_subcrystal(self, element, reduced_word, only_support=True):
249249
sage: K = crystals.KirillovReshetikhin(['A',1,1], 1, 2)
250250
sage: mg = K.module_generator()
251251
sage: S = K.demazure_subcrystal(mg, [1])
252-
sage: S.digraph().edges()
252+
sage: S.digraph().edges(sort=True)
253253
[([[1, 1]], [[1, 2]], 1), ([[1, 2]], [[2, 2]], 1)]
254254
sage: S = K.demazure_subcrystal(mg, [1], only_support=False)
255-
sage: S.digraph().edges()
255+
sage: S.digraph().edges(sort=True)
256256
[([[1, 1]], [[1, 2]], 1),
257257
([[1, 2]], [[1, 1]], 0),
258258
([[1, 2]], [[2, 2]], 1),
@@ -382,12 +382,12 @@ def dual_equivalence_graph(self, X=None, index_set=None, directed=True):
382382
383383
sage: T = crystals.Tableaux(['A',3], shape=[2,2])
384384
sage: G = T.dual_equivalence_graph()
385-
sage: sorted(G.edges())
385+
sage: G.edges(sort=True)
386386
[([[1, 3], [2, 4]], [[1, 2], [3, 4]], 2),
387387
([[1, 2], [3, 4]], [[1, 3], [2, 4]], 3)]
388388
sage: T = crystals.Tableaux(['A',4], shape=[3,2])
389389
sage: G = T.dual_equivalence_graph()
390-
sage: sorted(G.edges())
390+
sage: G.edges(sort=True)
391391
[([[1, 3, 5], [2, 4]], [[1, 3, 4], [2, 5]], 4),
392392
([[1, 3, 5], [2, 4]], [[1, 2, 5], [3, 4]], 2),
393393
([[1, 3, 4], [2, 5]], [[1, 2, 4], [3, 5]], 2),
@@ -399,18 +399,18 @@ def dual_equivalence_graph(self, X=None, index_set=None, directed=True):
399399
sage: G = T.dual_equivalence_graph(index_set=[1,2,3])
400400
sage: G.vertices(sort=True)
401401
[[[1, 3, 4], [2]], [[1, 2, 4], [3]], [[1, 2, 3], [4]]]
402-
sage: G.edges()
402+
sage: G.edges(sort=True)
403403
[([[1, 3, 4], [2]], [[1, 2, 4], [3]], 2),
404404
([[1, 2, 4], [3]], [[1, 2, 3], [4]], 3)]
405405
406406
TESTS::
407407
408408
sage: T = crystals.Tableaux(['A',4], shape=[3,1])
409409
sage: G = T.dual_equivalence_graph(index_set=[2,3])
410-
sage: sorted(G.edges())
410+
sage: G.edges(sort=True)
411411
[([[1, 2, 4], [3]], [[1, 2, 3], [4]], 3),
412412
([[2, 4, 5], [3]], [[2, 3, 5], [4]], 3)]
413-
sage: sorted(G.vertices(sort=True))
413+
sage: G.vertices(sort=True)
414414
[[[1, 3, 4], [2]],
415415
[[1, 2, 4], [3]],
416416
[[2, 4, 5], [3]],
@@ -831,12 +831,12 @@ def dual_equivalence_class(self, index_set=None):
831831
832832
sage: T = crystals.Tableaux(['A',3], shape=[2,2])
833833
sage: G = T(2,1,4,3).dual_equivalence_class()
834-
sage: sorted(G.edges())
834+
sage: G.edges(sort=True)
835835
[([[1, 3], [2, 4]], [[1, 2], [3, 4]], 2),
836836
([[1, 3], [2, 4]], [[1, 2], [3, 4]], 3)]
837837
sage: T = crystals.Tableaux(['A',4], shape=[3,2])
838838
sage: G = T(2,1,4,3,5).dual_equivalence_class()
839-
sage: sorted(G.edges())
839+
sage: G.edges(sort=True)
840840
[([[1, 3, 5], [2, 4]], [[1, 3, 4], [2, 5]], 4),
841841
([[1, 3, 5], [2, 4]], [[1, 2, 5], [3, 4]], 2),
842842
([[1, 3, 5], [2, 4]], [[1, 2, 5], [3, 4]], 3),

src/sage/categories/semigroups.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,15 +241,15 @@ def cayley_graph(self, side="right", simple=False, elements = None, generators =
241241
sage: g = S.cayley_graph(simple=True)
242242
sage: g.vertices(sort=True)
243243
['a', 'ab', 'b', 'ba']
244-
sage: g.edges()
244+
sage: g.edges(sort=True)
245245
[('a', 'ab', None), ('b', 'ba', None)]
246246
247247
::
248248
249249
sage: g = S.cayley_graph(side="left", simple=True)
250250
sage: g.vertices(sort=True)
251251
['a', 'ab', 'b', 'ba']
252-
sage: g.edges()
252+
sage: g.edges(sort=True)
253253
[('a', 'ba', None), ('ab', 'ba', None), ('b', 'ab', None),
254254
('ba', 'ab', None)]
255255
@@ -258,7 +258,7 @@ def cayley_graph(self, side="right", simple=False, elements = None, generators =
258258
sage: g = S.cayley_graph(side="twosided", simple=True)
259259
sage: g.vertices(sort=True)
260260
['a', 'ab', 'b', 'ba']
261-
sage: g.edges()
261+
sage: g.edges(sort=True)
262262
[('a', 'ab', None), ('a', 'ba', None), ('ab', 'ba', None),
263263
('b', 'ab', None), ('b', 'ba', None), ('ba', 'ab', None)]
264264
@@ -267,7 +267,7 @@ def cayley_graph(self, side="right", simple=False, elements = None, generators =
267267
sage: g = S.cayley_graph(side="twosided")
268268
sage: g.vertices(sort=True)
269269
['a', 'ab', 'b', 'ba']
270-
sage: g.edges()
270+
sage: g.edges(sort=True)
271271
[('a', 'a', (0, 'left')), ('a', 'a', (0, 'right')), ('a', 'ab', (1, 'right')), ('a', 'ba', (1, 'left')), ('ab', 'ab', (0, 'left')), ('ab', 'ab', (0, 'right')), ('ab', 'ab', (1, 'right')), ('ab', 'ba', (1, 'left')), ('b', 'ab', (0, 'left')), ('b', 'b', (1, 'left')), ('b', 'b', (1, 'right')), ('b', 'ba', (0, 'right')), ('ba', 'ab', (0, 'left')), ('ba', 'ba', (0, 'right')), ('ba', 'ba', (1, 'left')), ('ba', 'ba', (1, 'right'))]
272272
273273
::

0 commit comments

Comments
 (0)