replace push_back with emplace_back and enable colorlinks

This commit is contained in:
Johannes Kapfhammer 2021-02-10 20:28:36 +01:00
parent 1cbaab8e46
commit d0f6df5d24
3 changed files with 21 additions and 22 deletions

BIN
book.pdf

Binary file not shown.

View File

@ -8,7 +8,7 @@
\usepackage[table]{xcolor}
\usepackage{tikz}
\usepackage{multicol}
\usepackage{hyperref}
\usepackage[colorlinks=true]{hyperref}
\usepackage{array}
\usepackage{microtype}
@ -105,9 +105,8 @@
\include{chapter16}
%\include{chapter20}
\chapter{State Graphs}
Please watch the video about state graphs.
The video should be linked on the graph overview site, but please push Johannes
to fix the link here too.
Please watch the video about state graphs.\\
\url{https://www.youtube.com/watch?v=RdK3b9QWs94}
\part{Advanced topics}
\include{chapter15}

View File

@ -545,11 +545,11 @@ with weight $w$. For example, the graph
can be stored as follows:
\begin{lstlisting}
g.assign(4, {});
g[0].push_back({1,5});
g[1].push_back({2,7});
g[1].push_back({3,6});
g[2].push_back({3,5});
g[3].push_back({0,2});
g[0].emplace_back(1,5);
g[1].emplace_back(2,7);
g[1].emplace_back(3,6);
g[2].emplace_back(3,5);
g[3].emplace_back(0,2);
\end{lstlisting}
The benefit of using adjacency lists is that
@ -723,11 +723,11 @@ Thus, the graph
\end{center}
can be represented as follows:
\begin{lstlisting}
edges.push_back({0,2});
edges.push_back({1,3});
edges.push_back({1,4});
edges.push_back({2,4});
edges.push_back({3,1});
edges.emplace_back(0,2);
edges.emplace_back(1,3);
edges.emplace_back(1,4);
edges.emplace_back(2,4);
edges.emplace_back(3,1);
\end{lstlisting}
\noindent
@ -756,14 +756,14 @@ For example, the graph
\end{tikzpicture}
\end{center}
\begin{samepage}
can be represented as follows\footnote{In some older compilers, the function
\texttt{make\_tuple} must be used instead of the braces (for example,
\texttt{make\_tuple(1,2,5)} instead of \texttt{\{1,2,5\}}).}:
can be represented as follows\footnote{Instead of \texttt{emplace\_back(0,2,5)},
one could also write \texttt{edges.push\_back(\{0,2,5\})} or
\texttt{edges.push\_back(make\_tuple(0,2,5))}, however, using \texttt{emplace\_back} is generally preferred.}:
\begin{lstlisting}
edges.push_back({0,2,5});
edges.push_back({1,3,7});
edges.push_back({1,4,6});
edges.push_back({2,4,5});
edges.push_back({3,1,2});
edges.emplace_back(0,2,5);
edges.emplace_back(1,3,7);
edges.emplace_back(1,4,6);
edges.emplace_back(2,4,5);
edges.emplace_back(3,1,2);
\end{lstlisting}
\end{samepage}