I need some math directions since I'm lost.
Problem: I have $2$ values $n$ ($1 \le n \le 20000$) and $m$ ($0 \le m \le 50000$). $n$ is the number of statements and $m$ is the number of implications that have already been proved.
I also have $m$ pair of values $s_1$ and $s_2$ ($1 \le s_1$, $s_2 \le n$ and $s_1 \ne s_2$). These pairs indicate that it has been proved that statement $s_1$ implies statement $s_2$.
I need to find the minimum number of additional implications that need to be proved in order to prove that all statements are equivalent.
I have the answer of 2 cases:
$n=4$
$m=0$
answer: $4$$n=3$
$m=2$
pairs:
$1,2$
$1,3$
answer: $2$
I don't understand why the answer is 4 and 2 respectively.
So my question is if somebody could point me in a direction on what I need to learn to solve this? I've never read discrete math but that it has a implications part, is this it?
if so how should I interpret the data to make some neat implications equations e.g. $s_1 \to s_2$ and then make a implications table to calculate it?





In the first case, a graph with four vertices $\{a, b, c, d\}$ but no edges, you need to add at least four edges to make the cycle of statements $$ a \implies b \implies c \implies d \implies a$$ and by a little experimenting, you can see that joining these vertices up into a loop like this is the most efficient way to solve it.
In the second case, you start with three vertices $\{a, b, c\}$ and the two edges $a \implies b$ and $a \implies c$. Firstly, you need to be able to start with $b$ or $c$ and get back to $a$, so you could add the two edges $\{b \implies a, c \implies a\}$, which would then give every implication. Otherwise, you could do something like add the edges $\{b \implies c, c \implies a\}$ which would also do the trick. Either way, adding two edges is the most efficient way to have every implication.
In general, you will be looking for a way to add the least number of edges to make the graph strongly connected. There are nice algorithms to reduce a graph to its strongly connected components, which leave you with the same problem to solve on a directed acyclic graph. So perhaps think of how to solve this problem first for a directed acyclic graph, then for a general graph.