Skip to content

Commit 5694234

Browse files
committed
commit fixtures
Signed-off-by: Arya Pratap Singh <notaryasingh@gmail.com>
1 parent 600425c commit 5694234

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

graphs/blossom_algorithm.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818

1919
from __future__ import annotations
2020

21-
from typing import List
22-
2321

2422
class BlossomAlgorithm:
2523
"""
@@ -51,7 +49,7 @@ class BlossomAlgorithm:
5149
1
5250
"""
5351

54-
def __init__(self, graph: List[List[int]]) -> None:
52+
def __init__(self, graph: list[list[int]]) -> None:
5553
"""
5654
Initialize the Blossom algorithm with a graph.
5755
@@ -69,7 +67,7 @@ def __init__(self, graph: List[List[int]]) -> None:
6967
self.n = len(graph)
7068
self.mate = [-1] * self.n # mate[i] = j if edge (i,j) is in matching
7169

72-
def maximum_matching(self) -> List[int]:
70+
def maximum_matching(self) -> list[int]:
7371
"""
7472
Find maximum cardinality matching using greedy approach.
7573
@@ -110,7 +108,7 @@ def get_matching_size(self) -> int:
110108
"""
111109
return sum(1 for mate in self.mate if mate != -1) // 2
112110

113-
def get_matching_edges(self) -> List[tuple[int, int]]:
111+
def get_matching_edges(self) -> list[tuple[int, int]]:
114112
"""
115113
Get the list of matched edges.
116114
@@ -124,7 +122,7 @@ def get_matching_edges(self) -> List[tuple[int, int]]:
124122
return edges
125123

126124

127-
def maximum_matching_blossom(graph: List[List[int]]) -> List[tuple[int, int]]:
125+
def maximum_matching_blossom(graph: list[list[int]]) -> list[tuple[int, int]]:
128126
"""
129127
Convenience function to find maximum matching using Blossom algorithm.
130128

0 commit comments

Comments
 (0)