  We study the typical structure and the number of triangle-free graphs with
$n$ vertices and $m$ edges where $m$ is large enough so that a typical
triangle-free graph has a cut containing nearly all of its edges, but may not
be bipartite.
  Erd\H{o}s, Kleitman, and Rothschild showed that almost every triangle-free
graph is bipartite. Osthus, Pr\"omel, and Taraz later showed that for $m \ge
(1+\epsilon)\frac{\sqrt{3}}{4}n^{3/2}\sqrt{\log n}$, almost every triangle-free
graph on $n$ vertices and $m$ edges is bipartite. Here we give a precise
characterization of the distribution of edges within each part of the max cut
of a uniformly chosen triangle-free graph $G$ on $n$ vertices and $m$ edges,
for a larger range of densities with $m=\Theta(n^{3/2} \sqrt{\log n})$. Using
this characterization, we describe the evolution of the structure of typical
triangle-free graphs as the density changes. We show that as the number of
edges decreases below $\frac{\sqrt{3}}{4} n^{3/2}\sqrt{\log n}$, the following
structural changes occur in $G$:
  -Isolated edges, then trees, then more complex subgraphs emerge as `defect
edges', edges within parts of a max cut of $G$. The distribution of defect
edges is first that of independent Erd\H{o}s-R\'{e}nyi random graphs, then that
of independent exponential random graphs, conditioned on a small maximum degree
and no triangles.
  -There is a sharp threshold for $3$-colorability at $m \sim
\frac{\sqrt{2}}{4} n^{3/2}\sqrt{\log n}$ and a sharp threshold between
$4$-colorability and unbounded chromatic number at
$m\sim\frac{1}{4}n^{3/2}\sqrt{\log n}$.
  -Giant components emerge in the defect edges at $m\sim\frac{1}{4}
n^{3/2}\sqrt{\log n}$.
  We use these results to prove asymptotic formulas for the number of
triangle-free graphs at these densities. We also prove analogous results for
$G(n,p)$ conditioned on triangle-freeness.
