Mehr Doku zu Erreichbarkeit von Knoten

This commit is contained in:
joachimschmidt557 2019-02-14 16:10:42 +01:00
parent fa9ca8a340
commit 5eb7dd85ac

View file

@ -1,5 +1,13 @@
\documentclass{article}
\usepackage{amsmath}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\makeatletter
\def\BState{\State\hskip-\ALG@thistlm}
\makeatother
\title{FOP Projektgruppe 175}
\author{Steffen Wagner\\
Dennis Weinberger\\
@ -22,6 +30,29 @@
Der Algorithmus, der prüft, ob alle Knoten erreichbar sind, ist
folgender:
tbc
\begin{algorithm}
\caption{Erreichbarkeit aller Knoten}\label{euclid}
\begin{algorithmic}[1]
\Procedure{allNodesConnected}{}
\State $\textit{firstNode} \gets \text{first element of }\textit{nodes}$
\State $allVisitedNodes \gets \textit{empty}$
\State $nextVisitNodes \gets empty$
\State $\text{append } firstNode \text{ to } allVisitedNodes$
\State $\text{neighborsOf } firstNode$
\State $\rightarrow \text{filter out all } x \text{ where } allVisitedNodes \text{ contains } x$
\State $\rightarrow \text{append to } nextVisitNodes$
\BState \emph{loop}
\If {$nextVisitNodes \text{ is empty}$}
break
\EndIf
\State $\text{neighborsOf first element of } nextVisitNodes$
\State $\rightarrow \text{filter out all } x \text{ where } allVisitedNodes \text{ contains } x$
\State $\rightarrow \text{append to } nextVisitNodes$
\State $\text{append first element of } nextVisitNodes \text{ to } allVisitedNodes$
\State $\text{delete first element of } nextVisitNodes$
\BState \emph{end loop}
\EndProcedure
\end{algorithmic}
\end{algorithm}
\end{document}