# Leetcode 1557. Minimum number of vertices to reach all nodes
## 計算所有節點入度
入度為零的節點加入答案中
```python=
class Solution:
def findSmallestSetOfVertices(self, n: int, edges: List[List[int]]) -> List[int]:
in_degree = [0] * n
output = []
for ai,bi in edges:
in_degree[bi] += 1
for i in range(n):
degree = in_degree[i]
if degree == 0:
output.append(i)
return output
```