I was going through the concept of graphs as matroids and I came upon the rank of a graph. Wikipedia lists it as $n - c$, $n = |V|$, $c =$ # of connected components.
I do understand rank and nullity of matrices, and graphs when expressed in their incidence matrix form have a one-to-one correspondence with the rank of its incidence matrix. However, I am not understanding how $r(G) = |V| - c$, $c = $ # of connected components and the definition of rank as the maximum size of a subforest of $G$ are equivalent.
I tried looking it up online but found no satisfactory explanation. Any resources that would be helpful to understand the concept would be great.