The flow semigroup, introduced by John Rhodes, is an invariant for digraphs and a complete invariant for graphs. We refine and prove Rhodes's conjecture on the structure of the maximal groups in the flow semigroup for finite, antisymmetric, strongly connected graphs. Building on this result, we investigate and fully describe the structure and actions of the maximal subgroups of the flow semigroup acting on all but k points for all finite digraphs and graphs for all k >=1. A linear algorithm is presented to determine these so-called 'defect k groups' for any finite (di)graph. Finally, we prove that the complexity of the flow semigroup of a 2-vertex connected (and strongly connected di)graph with n vertices is n- 2, completely confirming Rhodes's conjecture for such (di)graphs.