I have the following latex file which I am compiling with LuaLatex on Overleaf:
\documentclass{article}
\usepackage{graphicx} % Pictures
\usepackage{amsmath} % Maths formulas
\usepackage{float} % Figure placement
\usepackage[margin=3cm]{geometry}
\usepackage{tikz} % Pretty graphs
\usetikzlibrary{graphs}
\usetikzlibrary{graphdrawing}
\usegdlibrary{trees, layered}
\title{Assignment 1}
\begin{document}
\pagenumbering{arabic}
\maketitle
\section{}
\subsection*{a.}
In the following table, the first row corresponds to the setup step of Dijkstra's algorithm and the other rows correspond to the state during each iteration of the for loop in the algorithm.
\begin{table}[h!]
\begin{center}
\label{tab:table1}
\begin{tabular}{c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c}
\textbf{$\#$} & \textbf{T} & \textbf{$u_1$} & \textbf{$u_2$} & \textbf{$u_3$} & \textbf{$u_4$} & \textbf{$u_5$} & \textbf{$u_6$} & \textbf{$u_7$} & \textbf{$P_1$} & \textbf{$P_2$} & \textbf{$P_3$} & \textbf{$P_4$} & \textbf{$P_5$} & \textbf{$P_6$} & \textbf{$P_7$}\\
\hline
\textbf{0} & \textbf{$\{2,3,4,5,6,7\}$} & \textbf{0} & \textbf{2} & \textbf{5} & \textbf{$\infty$} & \textbf{$\infty$} & \textbf{$\infty$} & \textbf{$\infty$} & \textbf{1} & \textbf{1} & \textbf{1} & \textbf{1} & \textbf{1} & \textbf{1} & \textbf{1}\\
\hline
\textbf{1} & \textbf{$\{3,4,5,6,7\}$} & \textbf{0} & \textbf{2} & \textbf{5} & \textbf{$\infty$} & \textbf{$\infty$} & \textbf{6} & \textbf{$\infty$} & \textbf{1} & \textbf{1} & \textbf{1} & \textbf{1} & \textbf{1} & \textbf{2} & \textbf{1}\\
\hline
\textbf{2} & \textbf{$\{4,5,6,7\}$} & \textbf{0} & \textbf{2} & \textbf{5} & \textbf{12} & \textbf{$\infty$} & \textbf{6} & \textbf{7} & \textbf{1} & \textbf{1} & \textbf{1} & \textbf{3} & \textbf{1} & \textbf{2} & \textbf{3}\\
\hline
\textbf{3} & \textbf{$\{4,5,7\}$} & \textbf{0} & \textbf{2} & \textbf{5} & \textbf{12} & \textbf{12} & \textbf{6} & \textbf{7} & \textbf{1} & \textbf{1} & \textbf{1} & \textbf{3} & \textbf{6} & \textbf{2} & \textbf{3}\\
\hline
\textbf{4} & \textbf{$\{4,5\}$} & \textbf{0} & \textbf{2} & \textbf{5} & \textbf{9} & \textbf{12} & \textbf{6} & \textbf{7} & \textbf{1} & \textbf{1} & \textbf{1} & \textbf{7} & \textbf{6} & \textbf{2} & \textbf{3}\\
\hline
\textbf{5} & \textbf{$\{5\}$} & \textbf{0} & \textbf{2} & \textbf{5} & \textbf{9} & \textbf{12} & \textbf{6} & \textbf{7} & \textbf{1} & \textbf{1} & \textbf{1} & \textbf{7} & \textbf{6} & \textbf{2} & \textbf{3}\\
\end{tabular}
\end{center}
\end{table}
This is the resulting spanning tree:
\newline
\begin{figure}[H]
\begin{tikzpicture}
\tikz \graph[tree layout, nodes={circle,draw}]
{
1 -- {2,3};
2 -- 6 -- 5;
3 -- 7 -- 4;
};
\end{tikzpicture}
\end{figure}
\end{document}
It yields this result and I don't understand why:
I tried giving [h]
, [h!]
and [H]
to the figure float but I still can't get it to render below the text.