For any row-finite graph E and any field K we construct the {\its Leavitt path algebra} L(E) having coefficients in K. When K is the field of complex numbers, then L(E) is the algebraic analog of the Cuntz Krieger algebra C∗(E) described in [8]. The matrix rings Mn(K) and the Leavitt algebras L(1,n) appear as algebras of the form L(E) for various graphs E. In our main result, we give necessary and sufficient conditions on E which imply that L(E) is simple.