This commit is contained in:
krahets
2023-09-17 01:11:33 +08:00
parent 221bec3ea3
commit fca420d938
12 changed files with 64 additions and 15 deletions
+1 -1
View File
@@ -1164,7 +1164,7 @@ comments: true
def __init__(self, edges: list[list[Vertex]]):
"""构造方法"""
# 邻接表,key: 顶点,value:该顶点的所有邻接顶点
self.adj_list = dict[Vertex, Vertex]()
self.adj_list = dict[Vertex, list[Vertex]]()
# 添加所有顶点和边
for edge in edges:
self.add_vertex(edge[0])