pseudo code added, nothing more to add

main
Luca Lombardo 3 years ago
parent ec3026938b
commit 750608928a

@ -37,20 +37,43 @@ During the computation of the farness, for each node, we have to compute the dis
\textsc{Scrivere pseudocodice} \textsc{Scrivere pseudocodice}
\begin{algorithm}
\caption{The lower bound technique}\label{alg:lowerbound-technique}
\begin{algorithmic}
% \begin{algorithmic}[H] \caption{How to write algorithms} \Require A graph $G = (V,E)$
% \KwIn{A graph $G = (V,E)$} \Ensure A list of the top-$k$ nodes with higher closeness centrality
% \KwOut{Top-$k$ nodes with higher closeness centrality and their value} \
% \ \State global \texttt{Top}$\gets [~]$;
\State global \texttt{enqueued}, \texttt{Q};
% \While{not at end of this document}{
% read current\; \For{$v \in V$}
% \eIf{understand}{ \State \texttt{enqueued[i] = false;}
% go to next section\; \EndFor
% current section becomes this one\;
% }{ \While{\texttt{Q} \emph{is not empty}}
% go back to the beginning of current section\;
% } \State \texttt{Q.pop} \Comment{Extract first element of the queue};
% } \State Set the lower-bound;
% \end{algorithmic} \If{\texttt{|Top|> k} \emph{and} \texttt{Top[k] $\leq$ lower-bound}}
\State \texttt{Skip = True}; \Comment{Stop the BFS}
\Else
\State Compute the farness; \Comment{BFS reached the end}
\State \texttt{Top.pop\textunderscore back}; \Comment{Remove the last element}
\State Add the new node, in order of farness;
\State update \texttt{Q, enqueued};
\EndIf
\EndWhile
\end{algorithmic}
\end{algorithm}
\nd In Algorithm \ref*{alg:lowerbound-technique} we use a list \texttt{Top} containing the top analyzed (yet) nodes in increasing order of farness. Then we need a vector of booleans \texttt{enqueued} to see which nodes we put in the queue during the BFS. During the BFS we need a "FIFO" priority queue \texttt{Q}. All the technical details are left to the reader in the GitHub repository.

Binary file not shown.

1
tex/src/main.tex vendored

@ -10,6 +10,7 @@
\usepackage{listings} \usepackage{listings}
\usepackage{xcolor} \usepackage{xcolor}
\usepackage{imakeidx} \usepackage{imakeidx}
\usepackage{algorithm}
\usepackage{algpseudocode} \usepackage{algpseudocode}
\usepackage{hyperref} \usepackage{hyperref}
\usepackage{textcomp} \usepackage{textcomp}

Loading…
Cancel
Save