-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from nbro/iss50
Iss50
- Loading branch information
Showing
4 changed files
with
323 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
|
||
""" | ||
# Meta info | ||
Author: Nelson Brochado | ||
Created: 08/03/2017 | ||
Updated: 08/03/2017 | ||
# Description | ||
Module which contains the abstract class from which DisjointSetsForest derives. | ||
The reason to have this abstract class is because | ||
a disjoint-sets data structure can possibly be implemented in different ways. | ||
""" | ||
|
||
from abc import ABCMeta, abstractmethod | ||
|
||
__all__ = ["DisjointSets"] | ||
|
||
|
||
class DisjointSets(metaclass=ABCMeta): | ||
"""Abstract class from which DisjointSetsForest derives. | ||
A DisjointSets data structure is sometimes also called DisjointSet, UnionFind or MergeSet""" | ||
|
||
@abstractmethod | ||
def make_set(self, x: object) -> None: | ||
pass | ||
|
||
@abstractmethod | ||
def find(self, x: object) -> object: | ||
pass | ||
|
||
@abstractmethod | ||
def union(self, x: object, y: object) -> object: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.