  Let $E$ be a row-finite quiver and let $E_0$ be the set of vertices of $E$;
consider the adjacency matrix $N'_E=(n_{ij})\in\Z^{(E_0\times E_0)}$,
$n_{ij}=#\{$ arrows from $i$ to $j\}$. Write $N^t_E$ and 1 for the matrices
$\in \Z^{(E_0\times E_0\setminus\Sink(E))}$ which result from $N'^t_E$ and from
the identity matrix after removing the columns corresponding to sinks. We
consider the $K$-theory of the Leavitt algebra $L_R(E)=L_\Z(E)\otimes R$. We
show that if $R$ is either a Noetherian regular ring or a stable $C^*$-algebra,
then there is an exact sequence ($n\in\Z$) \[
K_n(R)^{(E_0\setminus\Sink(E))}\stackrel{1-N_E^t}{\longrightarrow}
K_n(R)^{(E_0)}\to K_n(L_R(E))\to K_{n-1}(R)^{(E_0\setminus\Sink(E))} \] We also
show that for general $R$, the obstruction for having a sequence as above is
measured by twisted nil-$K$-groups. If we replace $K$-theory by homotopy
algebraic $K$-theory, the obstructions dissapear, and we get, for every ring
$R$, a long exact sequence \[
KH_n(R)^{(E_0\setminus\Sink(E))}\stackrel{1-N_E^t}{\longrightarrow}KH_n(R)^{(E_0)}\to
KH_n(L_R(E))\to KH_{n-1}(R)^{(E_0\setminus\Sink(E))} \] We also compare, for a
$C^*$-algebra $\fA$, the algebraic $K$-theory of $L_\fA(E)$ with the
topological $K$-theory of the Cuntz-Krieger algebra $C^*_\fA(E)$. We show that
the map \[ K_n(L_\fA(E))\to K^{\top}_n(C^*_\fA(E)) \] is an isomorphism if
$\fA$ is stable and $n\in\Z$, and also if $\fA=\C$, $n\ge 0$, $E$ is finite
with no sinks, and $\det(1-N_E^t)\ne 0$.
