Merge remote-tracking branch 'origin/master'

# Conflicts:
#	graphs/edmonds_blossom_algorithm.py
This commit is contained in:
Tarun Vishwakarma 2024-10-14 21:25:07 +05:30
commit ebb8055450

View File

@ -113,9 +113,9 @@ class EdmondsBlossomAlgorithm:
parent[y] = current # Update the parent parent[y] = current # Update the parent
augmenting_path_found = True augmenting_path_found = True
# Augment along this path # Augment along this path
EdmondsBlossomAlgorithm.update_matching(match, EdmondsBlossomAlgorithm.update_matching(
parent, match, parent, y
y) )
break break
# Case 2: y is matched; # Case 2: y is matched;
@ -129,14 +129,25 @@ class EdmondsBlossomAlgorithm:
else: else:
# Case 3: Both current and y have a parent; # Case 3: Both current and y have a parent;
# check for a cycle/blossom # check for a cycle/blossom
base_u = EdmondsBlossomAlgorithm.find_base(base, parent, base_u = EdmondsBlossomAlgorithm.find_base(
current, y) base, parent, current, y
)
if base_u != EdmondsBlossomAlgorithm.UNMATCHED: if base_u != EdmondsBlossomAlgorithm.UNMATCHED:
EdmondsBlossomAlgorithm.contract_blossom(BlossomData( EdmondsBlossomAlgorithm.contract_blossom(
BlossomAuxData(queue, parent, BlossomData(
base, in_blossom, BlossomAuxData(
match, in_queue), queue,
current, y, base_u)) parent,
base,
in_blossom,
match,
in_queue,
),
current,
y,
base_u,
)
)
# Create result list of matched pairs # Create result list of matched pairs
matching_result: list[list[int]] = [] matching_result: list[list[int]] = []