Bases: object
Implements a cover of a set, i.e. an assignment of its elements to possibly overlapping subsets.
n (int or networkit.Partition, optional) – Used for initialization of the cover. Either a node or a partition. Default: 0
Add the (previously unassigned) element e to the set s.
s (int) – The input subset.
e (int) – The element to be added.
Assigns every element to a singleton set. Set id is equal to element id.
Check if cover assigns a valid subset to the element e.
e (int) – The input element.
True, if e is assigned to a valid subset, False otherwise.
bool
Add an additional element (node).
Id of added node.
int
Get the members of a specific subset s.
The list of members of subset s.
list(int)
Get the ids of nonempty subsets.
A list of ids of nonempty subsets.
list(int)
Check if two elements e1 and e2 belong to the same subset.
e1 (int) – The first element.
e2 (int) – The second element.
True if e1 and e2 belong to the same subset; False otherwise.
bool
Get a lower bound for the subset ids that have been assigned.
A lower bound.
int
Assigns the elements from both sets to a new set.
s (int) – The first subset.
t (int) – The second subset.
Move the element e to subset s, i.e. remove it from all other subsets and place it in the subset.
s (int) – The input subset.
e (int) – The element to be moved.
Get the current number of elements in this cover.
The current number of elements.
int
Get the current number of sets in this cover.
The number of sets in this cover.
int
Remove the element e from the set s.
s (int) – The input subset.
e (int) – The element to be removed.
Sets an upper bound for the subset ids that CAN be assigned.
upper (int) – Upper bound.
Get a map from subset id to size of the subset.
A map from subset id to size of the subset.
dict(int :
int)
Get a list of subset sizes.
A list of subset sizes.
list(int)
Notes
Indices do not necessarily correspond to subset ids.
Get the ids of subsets in which the element e is contained.
e (int) – An element
A set of subset ids in which e is contained.
list(int)
Creates a singleton set containing the element e and returns the index of the new set.
e (int) – The input element.
The id of the new set.
int
Get an upper bound for the subset ids that have been assigned. (This is the maximum id + 1.)
An upper bound.
int
Bases: object
Implements a partition of a set, i.e. a subdivision of the set into disjoint subsets.
Create a new partition data structure for z elements.
size (int, optional) – Maximum index of an element. Default: 0
Add a (previously unassigned) element e to the set s.
s (int) – The index of the subset.
e (int) – The element to add.
Assigns every element to a singleton set. Set id is equal to element id.
Change subset IDs to be consecutive, starting at 0.
useTurbo (bool, optional) – If set to True, the C++ core uses a vector instead of a map to assign new ids which results in a shorter running time but possibly a large space overhead. Default: False
Check if partition assigns a valid subset to the element e.
e (int) – The input element.
True if the assigned subset is valid; False otherwise.
bool
Extend the data structure and create a slot for one more element.
Initializes the entry to none and returns the index of the entry.
The index of the new element.
int
Get the members of the subset s.
s (int) – The input subset.
A list containing the members of s.
list(int)
Get the human-readable identifier.
The name of this partition.
str
Get the ids of nonempty subsets.
A set of ids of nonempty subsets.
list(int)
Get the actual vector representing the partition data structure.
List containing information about partitions.
list(int)
Check if two elements e1 and e2 belong to the same subset.
e1 (int) – The first Element.
e2 (int) – The second Element.
True if e1 and e2 belong to same subset, False otherwise.
bool
Get a lower bound for the subset ids that have been assigned.
The lower bound.
int
Assigns the elements from both sets to a new set and returns the id of it.
s (int) – Set to merge.
t (int) – Set to merge.
Id of newly created set.
int
Move the (previously assigned) element e to the set `s.
s (int) – The index of the subset.
e (int) – The element to move.
Number of elements in the partition.
int
Get the current number of sets in this partition.
The current number of sets.
int
Set a human-readable identifier name for the instance.
name (str) – The input name.
Sets an upper bound for the subset ids that can be assigned.
upper (int) – Highest assigned subset id + 1.
Get the set (id) in which the element e is contained.
e (int) – Index of element.
The index of the set in which e is contained.
int
Get a map from subset id to size of the subset.
A map from subset id to size of the subset.
dict(int :
int)
Get a list of subset sizes. Indices do not necessarily correspond to subset ids.
A list of subset sizes.
list(int)
Creates a singleton set containing the element e.
e (int) – The index of the element.
Return an upper bound for the subset ids that have been assigned. (This is the maximum id + 1.)
The upper bound.
int