Skip to content

Commit

Permalink
Update src/sage/sets/disjoint_set.pyx
Browse files Browse the repository at this point in the history
  • Loading branch information
gmou3 committed Apr 24, 2024
1 parent afecde8 commit 9575aee
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/sage/groups/perm_gps/permgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5306,7 +5306,7 @@ def __init__(self, gens, action, domain, gap_group=None, category=None, canonica
for g_orbit in g_orbits:
for o in g_orbit:
for i in range(1, len(o)):
D._union(o[0], o[i])
D.union(o[0], o[i])
self._orbits = tuple(tuple(o) for o in D)

PermutationGroup_generic.__init__(self, gens=gens,
Expand Down
28 changes: 14 additions & 14 deletions src/sage/sets/disjoint_set.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ cpdef DisjointSet(arg):
- :meth:`~sage.sets.disjoint_set.DisjointSet_of_hashables.find` --
Determine which set a particular element is in.
- :meth:`~sage.sets.disjoint_set.DisjointSet_of_hashables.join` --
- :meth:`~sage.sets.disjoint_set.DisjointSet_of_hashables.union` --
Combine or merge two sets into a single set.
REFERENCES:
Expand Down Expand Up @@ -285,13 +285,13 @@ cdef class DisjointSet_class(SageObject):
sage: d = DisjointSet(5)
sage: d.cardinality()
5
sage: d.join(2, 4)
sage: d.union(2, 4)
sage: d.cardinality()
5
sage: d = DisjointSet(range(5))
sage: d.cardinality()
5
sage: d.join(2, 4)
sage: d.union(2, 4)
sage: d.cardinality()
5
"""
Expand All @@ -306,13 +306,13 @@ cdef class DisjointSet_class(SageObject):
sage: d = DisjointSet(5)
sage: d.number_of_subsets()
5
sage: d.join(2, 4)
sage: d.union(2, 4)
sage: d.number_of_subsets()
4
sage: d = DisjointSet(range(5))
sage: d.number_of_subsets()
5
sage: d.join(2, 4)
sage: d.union(2, 4)
sage: d.number_of_subsets()
4
"""
Expand Down Expand Up @@ -400,7 +400,7 @@ cdef class DisjointSet_of_integers(DisjointSet_class):

def __setstate__(self, l):
r"""
Merge the nodes ``i`` and ``l[i]`` (using join) for ``i`` in
Merge the nodes ``i`` and ``l[i]`` (using union) for ``i`` in
``range(len(l))``.
INPUT:
Expand Down Expand Up @@ -433,15 +433,15 @@ cdef class DisjointSet_of_integers(DisjointSet_class):
"""
cdef int i, parent
for i, parent in enumerate(l):
self.join(parent, i)
self.union(parent, i)

cpdef int find(self, int i):
r"""
Return the representative of the set that ``i`` currently belongs to.
INPUT:
- ``i`` -- element in ``self`` (no input checking)
- ``i`` -- element in ``self``
EXAMPLES::
Expand Down Expand Up @@ -581,7 +581,7 @@ cdef class DisjointSet_of_integers(DisjointSet_class):
sage: g.edges(sort=True) # needs sage.graphs
[(0, 0, None), (1, 2, None), (2, 2, None), (3, 2, None), (4, 2, None)]
The result depends on the ordering of the join::
The result depends on the ordering of the union::
sage: d = DisjointSet(5)
sage: d.union(1, 2)
Expand All @@ -603,7 +603,7 @@ cdef class DisjointSet_of_hashables(DisjointSet_class):
sage: d = DisjointSet('abcde'); d
{{'a'}, {'b'}, {'c'}, {'d'}, {'e'}}
sage: d.join('a', 'c'); d
sage: d.union('a', 'c'); d
{{'a', 'c'}, {'b'}, {'d'}, {'e'}}
sage: d.find('a')
'a'
Expand Down Expand Up @@ -731,15 +731,15 @@ cdef class DisjointSet_of_hashables(DisjointSet_class):
{{'a', 'b', 'c', 'd', 'e'}}
"""
for a, b in l:
self.join(a, b)
self.union(a, b)

cpdef find(self, e):
r"""
Return the representative of the set that ``e`` currently belongs to.
INPUT:
- ``e`` -- element in ``self`` (no input checking)
- ``e`` -- element in ``self``
EXAMPLES::
Expand All @@ -750,7 +750,7 @@ cdef class DisjointSet_of_hashables(DisjointSet_class):
4
sage: e.find(4)
4
sage: e.join(1,3); e
sage: e.union(1,3); e
{{0}, {1, 3}, {2, 4}}
sage: e.find(1)
1
Expand Down Expand Up @@ -860,7 +860,7 @@ cdef class DisjointSet_of_hashables(DisjointSet_class):
sage: g.edges(sort=True) # needs sage.graphs
[(0, 0, None), (1, 2, None), (2, 2, None), (3, 2, None), (4, 2, None)]
The result depends on the ordering of the join::
The result depends on the ordering of the union::
sage: d = DisjointSet(range(5))
sage: d.union(1, 2)
Expand Down

0 comments on commit 9575aee

Please sign in to comment.