Skip to content

Commit 63a7a96

Browse files
mhihasanshermanhui
authored andcommitted
Fix mypy errors at even_tree algo (TheAlgorithms#4579)
1 parent 353b4be commit 63a7a96

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

graphs/even_tree.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
from collections import defaultdict
1717

1818

19-
def dfs(start):
19+
def dfs(start: int) -> int:
2020
"""DFS traversal"""
2121
# pylint: disable=redefined-outer-name
2222
ret = 1
2323
visited[start] = True
24-
for v in tree.get(start):
24+
for v in tree[start]:
2525
if v not in visited:
2626
ret += dfs(v)
2727
if ret % 2 == 0:
@@ -48,8 +48,8 @@ def even_tree():
4848
if __name__ == "__main__":
4949
n, m = 10, 9
5050
tree = defaultdict(list)
51-
visited = {}
52-
cuts = []
51+
visited: dict[int, bool] = {}
52+
cuts: list[int] = []
5353
count = 0
5454
edges = [(2, 1), (3, 1), (4, 3), (5, 2), (6, 1), (7, 2), (8, 6), (9, 8), (10, 8)]
5555
for u, v in edges:

0 commit comments

Comments
 (0)