#include <UnionFind.h>
A weighted union find with path compression.
- Author
- Zhengrong Wang
| bool UnionFind::Connected |
( |
int |
p, |
|
|
int |
q |
|
) |
| const |
|
inline |
Are the two sites p and q in the same component?
- Parameters
-
| p | the integer representing one site |
| q | the integer representing the other site |
- Returns
true if the two sites p and q are in the same component, and false otherwise
- Exceptions
-
| java.lang.IndexOutOfBoundsException | unless both 0 <= p < N and 0 <= q < N |
| int UnionFind::Find |
( |
int |
p | ) |
const |
Returns the component identifier for the component containing site p.
- Parameters
-
| p | the integer representing one site |
- Returns
- the component identifier for the component containing site
p
- Exceptions
-
| java.lang.IndexOutOfBoundsException | unless 0 <= p < N |
| int UnionFind::GetCount |
( |
| ) |
const |
|
inline |
Returns the number of components.
- Returns
- the number of components (between 1 and N)
| int UnionFind::GetSize |
( |
int |
root | ) |
|
|
inline |
Returns the size of this components.
- Returns
- the size of this components (between 1 and N)
| void UnionFind::Union |
( |
int |
p, |
|
|
int |
q |
|
) |
| |
Merges the component containing sitep with the component containing site q.
- Parameters
-
| p | the integer representing one site |
| q | the integer representing the other site |
- Exceptions
-
| java.lang.IndexOutOfBoundsException | unless both 0 <= p < N and 0 <= q < N |
The documentation for this class was generated from the following files: