We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fbfe683 commit f8d82eaCopy full SHA for f8d82ea
9/2.py
@@ -19,11 +19,11 @@
19
graph[a].append((b, c))
20
21
def dijkstra(start):
22
- q = []
23
- # 시작 노드로 가기 위한 최단 경로는 0으로 설정하여, 큐에 삽입합니다.
24
- heapq.heappush(q, (0, start))
25
- distance[start] = 0
26
- while q: # 큐가 비어있지 않다면
+ q = []
+ # 시작 노드로 가기 위한 최단 경로는 0으로 설정하여, 큐에 삽입합니다.
+ heapq.heappush(q, (0, start))
+ distance[start] = 0
+ while q: # 큐가 비어있지 않다면
27
# 가장 최단 거리가 짧은 노드에 대한 정보를 꺼냅니다.
28
dist, now = heapq.heappop(q)
29
# 현재 노드가 이미 처리된 적이 있는 노드라면 무시합니다.
0 commit comments