We associate to each
row-finite directed graph E a universal Cuntz-Krieger C∗-algebra C∗(E), and study
how the distribution of loops in E affects the structure of C∗(E). We prove that
C∗(E) is AF if and only if E has no loops. We describe an exit condition (L)
on loops in E which allows us to prove an analogue of the Cuntz-Krieger
uniqueness theorem and give a characterisation of when C∗(E) is purely
infinite. If the graph E satisfies (L) and is cofinal, then we have a dichotomy: if
E has no loops, then C∗(E) is AF; if E has a loop, then C∗(E) is purely
infinite.