mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-12-01 00:41:09 +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
|
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]] = []
|
||||||
|
|
Loading…
Reference in New Issue
Block a user