refactor: Follow the PEP 585 Typing standard (#439)

* Follow the PEP 585 Typing standard

* Update list.py
This commit is contained in:
Yudong Jin
2023-03-23 18:51:56 +08:00
committed by GitHub
parent f4e01ea32e
commit 8918ec9079
43 changed files with 256 additions and 342 deletions
@@ -10,10 +10,10 @@ from modules import *
class GraphAdjList:
""" 基于邻接表实现的无向图类 """
def __init__(self, edges: List[List[Vertex]]) -> None:
def __init__(self, edges: list[list[Vertex]]) -> None:
""" 构造方法 """
# 邻接表,key: 顶点,value:该顶点的所有邻接顶点
self.adj_list: Dict = {}
self.adj_list = dict[Vertex, Vertex]()
# 添加所有顶点和边
for edge in edges:
self.add_vertex(edge[0])