11from functools import lru_cache
22from queue import PriorityQueue
3- from typing import Dict , List , Tuple
43
54import networkx as nx
65from matplotlib import pyplot as plt
@@ -33,7 +32,7 @@ def main() -> None:
3332 print (f"Result part 2: { result_part2 } " ) # expected for small input: 44169
3433
3534
36- def parse_state (lines : List [str ]) -> str :
35+ def parse_state (lines : list [str ]) -> str :
3736 state = ""
3837 for i , line in enumerate (lines ):
3938 state += line .replace ("#" , "" )
@@ -81,7 +80,7 @@ def draw_graph(graph: nx.Graph, target_path: str) -> None:
8180 plt .clf ()
8281
8382
84- def dijkstra (start_state : str , graph : nx .Graph ) -> Dict [str , int ]:
83+ def dijkstra (start_state : str , graph : nx .Graph ) -> dict [str , int ]:
8584 state2cost = {start_state : 0 }
8685 pq = PriorityQueue ()
8786 pq .put ((0 , start_state ))
@@ -100,7 +99,7 @@ def dijkstra(start_state: str, graph: nx.Graph) -> Dict[str, int]:
10099 return state2cost
101100
102101
103- def get_neighbours (state : str , graph : nx .Graph ) -> List [ Tuple [str , int ]]:
102+ def get_neighbours (state : str , graph : nx .Graph ) -> list [ tuple [str , int ]]:
104103 result = []
105104 for index , ch in enumerate (state ):
106105 if ch == "." :
0 commit comments