We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ede4d0c commit 3044514Copy full SHA for 3044514
1 file changed
10/6.py
@@ -10,14 +10,15 @@
10
# 방향 그래프의 모든 간선 정보를 입력 받기
11
for _ in range(e):
12
a, b = map(int, input().split())
13
- graph[a].append(b)
+ graph[a].append(b) # 정점 A에서 B로 이동 가능
14
# 진입 차수를 1 증가
15
indegree[b] += 1
16
17
# 위상 정렬 함수
18
def topology_sort():
19
result = [] # 알고리즘 수행 결과를 담을 리스트
20
q = deque() # 큐 기능을 위한 deque 라이브러리 사용
21
+
22
# 처음 시작할 때는 진입차수가 0인 노드를 큐에 삽입
23
for i in range(1, v + 1):
24
if indegree[i] == 0:
0 commit comments