1
0
Fork 0

Minor changes to docstrings

This commit is contained in:
Joris van Rantwijk 2024-07-06 22:32:19 +02:00
parent bbe19a6798
commit d2debb6d6f
2 changed files with 9 additions and 14 deletions

View File

@ -1,8 +1,4 @@
"""
Data structures for matching.
Experimental.
"""
"""Data structures for matching."""
from typing import Generic, Optional, TypeVar

View File

@ -341,13 +341,13 @@ class _Blossom:
An alternating cycle is an alternating path that starts and ends in
the same sub-blossom.
Blossoms are recursive structures: A non-trivial blossoms contains
sub-blossoms, which may themselves contain sub-blossoms etc.
A single vertex by itself is also a blossom: a "trivial blossom".
An instance of this class represents either a trivial blossom,
or a non-trivial blossom which consists of multiple sub-blossoms.
Blossoms are recursive structures: A non-trivial blossoms contains
sub-blossoms, which may themselves contain sub-blossoms etc.
or a non-trivial blossom.
Each blossom contains exactly one vertex that is not matched to another
vertex in the same blossom. This is the "base vertex" of the blossom.
@ -620,7 +620,6 @@ class _MatchingContext:
def __del__(self) -> None:
"""Delete reference cycles during cleanup of the matching context."""
for blossom in itertools.chain(self.trivial_blossom,
self.nontrivial_blossom):
blossom.parent = None
@ -1085,10 +1084,7 @@ class _MatchingContext:
assert blossom.tree_edge is None
assert blossom.tree_blossoms is None
def remove_alternating_tree(
self,
tree_blossoms: set[_Blossom]
) -> None:
def remove_alternating_tree(self, tree_blossoms: set[_Blossom]) -> None:
"""Reset the alternating tree consisting of the specified blossoms.
Marks the blossoms as unlabeled.
@ -1196,6 +1192,9 @@ class _MatchingContext:
Assign label S to the new blossom.
Relabel all T-sub-blossoms as S and add their vertices to the queue.
A blossom will not be expanded during the same stage in which
it was created.
This function takes total time O((n + m) * log(n)) per stage.
"""