Utility functions
|
Given the number of sets, generate unique subset IDs for all potentially non-empty sets. |
|
Given a list of sets, create a dictionary mapping subsets to set items. |
- matplotlib_set_diagrams.get_subset_ids(total_sets: int) list[Tuple[bool]][source]
Given the number of sets, generate unique subset IDs for all potentially non-empty sets.
- Parameters:
- total_setsint
The number of sets.
- Returns:
- subset_idslist[Tuple[bool]]
Subsets IDs are tuples of booleans using the inclusion/exclusion nomenclature, i.e. each entry in the tuple indicates if the corresponding set is a superset of the subset. For example, given the sets A, B, C, the subset (1, 1, 1) corresponds to the intersection of all three sets, whereas (1, 1, 0) is the subset formed by the difference between the intersection of A with B, and C.
- matplotlib_set_diagrams.get_subsets(sets: list[set]) dict[Tuple[bool], set][source]
Given a list of sets, create a dictionary mapping subsets to set items.
- Parameters:
- setslist[set]
The sets.
- Returns:
- subsetsdict[Tuple[bool], set]
A dictionary mapping subset IDs to subset items. Subsets IDs are tuples of booleans using the inclusion/exclusion nomenclature, i.e. each entry in the tuple indicates if the corresponding set is a superset of the subset. For example, given the sets A, B, C, the subset (1, 1, 1) corresponds to the intersection of all three sets, whereas (1, 1, 0) is the subset formed by the difference between the intersection of A with B, and C.