Equivalence relations (or partitions, equivalence classes) on finite sets.
See also Disjoint set/Union Find data structure on Wikipedia.
Type | Description |
Function or value | Description | ||
Full Usage:
canonize ptn a
Parameters:
partition<'a>
-
The input partition.
a : 'a
-
The element of the partition to search.
Returns: 'a
The canonical element of a 's equivalence class, if a is
an element in the domain of the partition; otherwise a itself.
|
Corresponds to the find method in the union-find algorithm.
Example
val f: obj
val ptn: obj
Evaluates to 1 .
Example
val f: obj
val ptn: obj
Evaluates to 8 .
|
||
|
Corresponds to the union method in the union-find algorithm.
Example
val f: obj
Evaluates to [(1, Terminal (1, 2)); (2, Nonterminal 1)] .
|
||
Full Usage:
equated ptn
Parameters:
partition<'a>
-
The input partition.
Returns: 'a list
The domain of the partition.
|
Example
val f: obj
val ptn: obj
Evaluates to [1; 2; 3; 4; 5; 6; 7] .
|
||
Full Usage:
equivalent ptn a b
Parameters:
partition<'a>
-
The input partition.
a : 'a
-
The first element to compare.
b : 'a
-
The second element to compare.
Returns: bool
true if a and b belong to the same equivalence class
in ptn ; otherwise false.
|
Example
val f: obj
val ptn: obj
Evaluates to true .
Example
val f: obj
val ptn: obj
Evaluates to false .
|
||
Full Usage:
terminus ptn a
Parameters:
partition<'a>
-
The input partition.
a : 'a
-
The element of the partition to search.
Returns: 'a * int
The pair of the canonical element of a 's equivalence class plus
its size, if a is an element in the domain of the partition.
|
Example
val f: obj
val ptn: obj
Evaluates to (1, 4) .
Example
val f: obj
val ptn: obj
Throws System.Exception: apply .
|
||
Full Usage:
tryterminus ptn a
Parameters:
partition<'a>
-
The input partition.
a : 'a
-
The element of the partition to search.
Returns: 'a * int
The pair of the canonical element of a 's equivalence class plus
its size, if a is an element in the domain of the partition;
otherwise (a, 1) .
|
Example
val f: obj
val ptn: obj
Evaluates to (1, 4) .
Example
val f: obj
val ptn: obj
Evaluates to (8, 1) .
|
||
|