isConnected method
Checks if two elements are in the same set
Implementation
bool isConnected(T element1, T element2) {
final root1 = find(element1);
final root2 = find(element2);
return root1 != null && root2 != null && root1 == root2;
}
Checks if two elements are in the same set
bool isConnected(T element1, T element2) {
final root1 = find(element1);
final root2 = find(element2);
return root1 != null && root2 != null && root1 == root2;
}