Skip to content

Commit b252232

Browse files
authored
Fix small grammar errors in topological-sort.md
1 parent d890b87 commit b252232

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/graph/topological-sort.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ The example graph also has multiple topological orders, a second topological ord
2626

2727
A Topological order may **not exist** at all.
2828
It only exists, if the directed graph contains no cycles.
29-
Otherwise because there is a contradiction: if there is a cycle containing the vertices $a$ and $b$, then $a$ needs to have a smaller index than $b$ (since you can reach $b$ from $a$) and also a bigger one (as you can reach $a$ from $b$).
29+
Otherwise, there is a contradiction: if there is a cycle containing the vertices $a$ and $b$, then $a$ needs to have a smaller index than $b$ (since you can reach $b$ from $a$) and also a bigger one (as you can reach $a$ from $b$).
3030
The algorithm described in this article also shows by construction, that every acyclic directed graph contains at least one topological order.
3131

32-
A common problem in which topological sorting occurs is the following. There are $n$ variables with unknown values. For some variables we know that one of them is less than the other. You have to check whether these constraints are contradictory, and if not, output the variables in ascending order (if several answers are possible, output any of them). It is easy to notice that this is exactly the problem of finding topological order of a graph with $n$ vertices.
32+
A common problem in which topological sorting occurs is the following. There are $n$ variables with unknown values. For some variables, we know that one of them is less than the other. You have to check whether these constraints are contradictory, and if not, output the variables in ascending order (if several answers are possible, output any of them). It is easy to notice that this is exactly the problem of finding the topological order of a graph with $n$ vertices.
3333

3434
## The Algorithm
3535

36-
To solve this problem we will use [depth-first search](depth-first-search.md).
36+
To solve this problem, we will use [depth-first search](depth-first-search.md).
3737

3838
Let's assume that the graph is acyclic. What does the depth-first search do?
3939

0 commit comments

Comments
 (0)