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