Skip to content

Commit

Permalink
minor details in Yang_Baxter graphs
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed Nov 8, 2024
1 parent 7fa30e6 commit a19b8d8
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/sage/combinat/yang_baxter_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def YangBaxterGraph(partition=None, root=None, operators=None):
OUTPUT: either:
- :class:`YangBaxterGraph_partition` -- if partition is defined
- :class:`YangBaxterGraph_generic` -- if partition is ``None``
- :class:`YangBaxterGraph_partition` -- if partition is defined
- :class:`YangBaxterGraph_generic` -- if partition is ``None``
EXAMPLES:
Expand Down Expand Up @@ -108,8 +108,7 @@ def YangBaxterGraph(partition=None, root=None, operators=None):
"""
if partition is None:
return YangBaxterGraph_generic(root=root, operators=operators)
else:
return YangBaxterGraph_partition(partition=Partition(partition))
return YangBaxterGraph_partition(partition=Partition(partition))

# *********** General class for Yang-Baxter Graphs ***********

Expand Down Expand Up @@ -203,7 +202,7 @@ def _digraph(self):
digraph.add_edge(u, v, l)
return digraph

def __hash__(self):
def __hash__(self) -> int:
r"""
TESTS::
Expand Down Expand Up @@ -236,7 +235,7 @@ def __eq__(self, other) -> bool:
sage: Y3.__eq__(Y2)
False
"""
return type(self) is type(other) and self._digraph == other._digraph
return isinstance(other, YangBaxterGraph_generic) and self._digraph == other._digraph

def __ne__(self, other) -> bool:
r"""
Expand Down Expand Up @@ -634,7 +633,7 @@ def _digraph(self):
[((0, 1, 0), (1, 0, 0), Swap positions 0 and 1)]
"""
digraph = super()._digraph
for (u, v, op) in digraph.edges(sort=True):
for u, v, op in digraph.edges(sort=True):
digraph.set_edge_label(u, v, SwapOperator(op.position()))
return digraph

Expand Down Expand Up @@ -777,7 +776,7 @@ def __init__(self, i):
"""
self._position = i

def __hash__(self):
def __hash__(self) -> int:
r"""
TESTS::
Expand Down

0 comments on commit a19b8d8

Please sign in to comment.