Ticket #8913: trac_8913-cayley_graph_twosided_labels-nt.patch
| File trac_8913-cayley_graph_twosided_labels-nt.patch, 2.1 KB (added by nthiery, 3 years ago) |
|---|
-
sage/categories/semigroups.py
# HG changeset patch # User Nicolas M. Thiery <nthiery@users.sf.net> # Date 1274217465 -7200 # Node ID 3cebf60dd52d70b56e7aa34e626a5b9b8defdf9b # Parent 4f19012b89ec89848289949779fe262a89da7103 #8913: S.cayley_graph(side = "twosided") returns broken labels diff --git a/sage/categories/semigroups.py b/sage/categories/semigroups.py
a b class Semigroups(Category): 227 227 228 228 :: 229 229 230 sage: g = S.cayley_graph(side="twosided") 231 sage: g.vertices() 232 ['a', 'ab', 'b', 'ba'] 233 sage: g.edges() 234 [('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'))] 235 236 :: 237 230 238 sage: s1 = SymmetricGroup(1); s = s1.cayley_graph(); s.vertices() 231 239 [()] 232 240 … … class Semigroups(Category): 269 277 generators = dict((self(g), self(g)) for g in generators) 270 278 left = (side == "left" or side == "twosided") 271 279 right = (side == "right" or side == "twosided") 272 def add_edge(source, target, label, side ):280 def add_edge(source, target, label, side_label): 273 281 """ 274 282 Skips edges whose targets are not in elements 275 283 Return an appropriate edge given the options … … class Semigroups(Category): 278 286 if simple: 279 287 result.add_edge([source, target]) 280 288 elif side == "twosided": 281 result.add_edge([source, target, (label, side )])289 result.add_edge([source, target, (label, side_label)]) 282 290 else: 283 291 result.add_edge([source, target, label]) 284 292 for x in elements:
