How to indent a long sentence in an algorithm
You can use tabularx
to figure out the width of a box that would fit until the end of the line:
\documentclass{article}
\usepackage{amsmath,algorithm,tabularx}
\usepackage[noend]{algpseudocode}
\makeatletter
\newcommand{\multiline}[1]{%
\begin{tabularx}{\dimexpr\linewidth-\ALG@thistlm}[t]{@{}X@{}}
#1
\end{tabularx}
}
\makeatother
\begin{document}
\begin{algorithm}
\caption{hello}
\begin{algorithmic}[1]
\Procedure{ASAPP}{}
\State $i \gets 0$, $j \gets 0$, $k \gets 0$
\While { $i \leq \text{nom}$ }
\While {$j \leq C_i$ }
\State \multiline{%
Considering the $j$-th edge of the $i$-th metabolite,~$x$ and~$y$
contains the vertices of the $j$-th edge}
\State $k \gets j + 1$
\While { $k \leq C_i$ }
\State \multiline{%
Considering the $k$-th edge of the $i$-th metabolite,~$x_1$ and~$y_1$
contains the vertices of the $k$-th edge.}
\EndWhile
\EndWhile
\EndWhile
\EndProcedure
\end{algorithmic}
\end{algorithm}
\end{document}
\multiline{<stuff>}
sets its contents in a tabularx
that is aligned at the [t]
op inside an X
-column. The width of this column is the difference of a regular \linewidth
minus the current algorithm line indent.