Skip to content

Commit

Permalink
Add num_groups for DisjointSets to documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ew-git committed Dec 29, 2022
1 parent 334f840 commit cb7ccdc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/src/disjoint_sets.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ Usage:
a = IntDisjointSets(10) # creates a forest comprised of 10 singletons
union!(a, 3, 5) # merges the sets that contain 3 and 5 into one and returns the root of the new set
root_union!(a, x, y) # merges the sets that have root x and y into one and returns the root of the new set
find_root!(a, 3) # finds the root element of the subset that contains 3
find_root!(a, 3) # finds the root element of the subset that contains 3
in_same_set(a, x, y) # determines whether x and y are in the same set
elem = push!(a) # adds a single element in a new set; returns the new element
# (this operation is often called MakeSet)
num_groups(a) # returns the number of sets
```

One may also use other element types:
Expand Down

0 comments on commit cb7ccdc

Please sign in to comment.