  We study the complexity of determining the edge connectivity of a simple
graph with cut queries. We show that (i) there is a bounded-error randomized
algorithm that computes edge connectivity with $O(n)$ cut queries, and (ii)
there is a bounded-error quantum algorithm that computes edge connectivity with
$\~O(\sqrt{n})$ cut queries. We prove these results using a new technique
called "star contraction" to randomly contract edges of a graph while
preserving non-trivial minimum cuts. In star contraction vertices randomly
contract an edge incident on a small set of randomly chosen vertices. In
contrast to the related 2-out contraction technique of Ghaffari, Nowicki, and
Thorup [SODA'20], star contraction only contracts vertex-disjoint star
subgraphs, which allows it to be efficiently implemented via cut queries.
  The $O(n)$ bound from item (i) was not known even for the simpler problem of
connectivity, and improves the $O(n\log^3 n)$ bound by Rubinstein, Schramm, and
Weinberg [ITCS'18]. The bound is tight under the reasonable conjecture that the
randomized communication complexity of connectivity is $\Omega(n\log n)$, an
open question since the seminal work of Babai, Frankl, and Simon [FOCS'86]. The
bound also excludes using edge connectivity on simple graphs to prove a
superlinear randomized query lower bound for minimizing a symmetric submodular
function. Item (ii) gives a nearly-quadratic separation with the randomized
complexity and addresses an open question of Lee, Santha, and Zhang [SODA'21].
The algorithm can also be viewed as making $\~O(\sqrt{n})$ matrix-vector
multiplication queries to the adjacency matrix.
  Finally, we demonstrate the use of star contraction outside of the cut query
setting by designing a one-pass semi-streaming algorithm for computing edge
connectivity in the vertex arrival setting. This contrasts with the edge
arrival setting where two passes are required.
