mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-30 16:31:08 +00:00
Merge remote-tracking branch 'origin/master'
# Conflicts: # graphs/edmonds_blossom_algorithm.py
This commit is contained in:
commit
ebb8055450
|
@ -113,9 +113,9 @@ class EdmondsBlossomAlgorithm:
|
|||
parent[y] = current # Update the parent
|
||||
augmenting_path_found = True
|
||||
# Augment along this path
|
||||
EdmondsBlossomAlgorithm.update_matching(match,
|
||||
parent,
|
||||
y)
|
||||
EdmondsBlossomAlgorithm.update_matching(
|
||||
match, parent, y
|
||||
)
|
||||
break
|
||||
|
||||
# Case 2: y is matched;
|
||||
|
@ -129,14 +129,25 @@ class EdmondsBlossomAlgorithm:
|
|||
else:
|
||||
# Case 3: Both current and y have a parent;
|
||||
# check for a cycle/blossom
|
||||
base_u = EdmondsBlossomAlgorithm.find_base(base, parent,
|
||||
current, y)
|
||||
base_u = EdmondsBlossomAlgorithm.find_base(
|
||||
base, parent, current, y
|
||||
)
|
||||
if base_u != EdmondsBlossomAlgorithm.UNMATCHED:
|
||||
EdmondsBlossomAlgorithm.contract_blossom(BlossomData(
|
||||
BlossomAuxData(queue, parent,
|
||||
base, in_blossom,
|
||||
match, in_queue),
|
||||
current, y, base_u))
|
||||
EdmondsBlossomAlgorithm.contract_blossom(
|
||||
BlossomData(
|
||||
BlossomAuxData(
|
||||
queue,
|
||||
parent,
|
||||
base,
|
||||
in_blossom,
|
||||
match,
|
||||
in_queue,
|
||||
),
|
||||
current,
|
||||
y,
|
||||
base_u,
|
||||
)
|
||||
)
|
||||
|
||||
# Create result list of matched pairs
|
||||
matching_result: list[list[int]] = []
|
||||
|
|
Loading…
Reference in New Issue
Block a user