\documentclass[unicode,11pt,a4paper,oneside,numbers=endperiod,openany]{scrartcl}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{amsmath}
\input{assignment.sty}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usetikzlibrary{plotmarks}
\usetikzlibrary{arrows.meta}
\usepgfplotslibrary{patchplots}
\usepackage{grffile}
\usepackage{amsmath}
\usepackage{subcaption}
\usepgfplotslibrary{external}
\tikzexternalize

\hyphenation{PageRank}
\hyphenation{PageRanks}

\begin{document}


\setassignment
\setduedate{Wednesday, 4 November 2020, 11:55 PM}

\serieheader{Numerical Computing}{2020}{Student: Claudio Maggioni}{Discussed with: --}{Solution for Project 3}{}
\newline

\assignmentpolicy

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Install METIS 5.0.2, and the corresponding Matlab mex interface}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Implement various graph partitioning algorithms \punkte{60}}
I summarize the various benchmark results in table \ref{table:bisection}. Please note that this table
can be generated at will with the script \texttt{ex2\_bisection\_table.m}.

\section{Visualize the Fiedler eigenvector\punkte{10}}

In figure \ref{fig:run1} there are graph outputs respectively from \textit{Grid9}, \textit{Small}, and \textit{Eppstein}.

\begin{figure}[h]
\begin{subfigure}{0.5\textwidth}
\centering
\includegraphics[trim=50 200 50 200,clip,width=\textwidth]{ex3_grid9.pdf}
	\caption{Plot for \textit{Grid9}}
\end{subfigure}
\begin{subfigure}{0.5\textwidth}
\centering
\includegraphics[trim=50 200 50 200,clip,width=\textwidth]{ex3_small.pdf}
	\caption{Plot for \textit{Small}}
\end{subfigure}
\begin{subfigure}{0.5\textwidth}
\includegraphics[trim=50 200 50 200,clip,width=\textwidth]{ex3_eppstein.pdf}
	\caption{Plot for \textit{Eppstein}}
\end{subfigure}
\caption{Graph outputs for the 3 adjacency matrices.}
\label{fig:run1}
\end{figure}

\section{Recursively bisecting meshes \punkte{20}}

I summarize my results in table \ref{table:Rec_bisection}. Additionaly, the graph plots
for a recursive partition in 16 parts of \textit{Crack} are avaliable in figure \ref{fig:bicrack}.

\begin{figure}[h]
\begin{subfigure}{0.5\textwidth}
\centering
	\resizebox{0.8\linewidth}{!}{
		\input{ex4_Spectral}}
\caption{Spectral bisection}
\end{subfigure}
\begin{subfigure}{0.5\textwidth}
\centering
	\resizebox{0.8\linewidth}{!}{
		\input{ex4_Coordinate}}
\caption{Coordinate bisection}
\end{subfigure}
\begin{subfigure}{0.5\textwidth}
\centering
	\resizebox{0.8\linewidth}{!}{
		\input{ex4_METIS}}
\caption{METIS bisection}
\end{subfigure}
\begin{subfigure}{0.5\textwidth}
\centering
	\resizebox{0.8\linewidth}{!}{
		\input{ex4_Inertial}}
\caption{Inertial bisection}
\end{subfigure}
	\caption{Graph outputs for \textit{Crack} graph with $n=16$}
\label{fig:bicrack}
\end{figure}



\section{Compare recursive bisection to direct $k$-way partitioning\punkte{10}}

Summarize your results in table \ref{table:Compare_Metis}.

\begin{table}[h]
	\caption{Bisection results}
	\centering
	\begin{tabular}{|l|r|r|r|r|} \hline\hline
		Mesh             &  Coordinate & Metis 5.0.2  & Spectral & Inertial  \\ \hline
		grid5rect(10,100)&   10 &        10 &           10  &      10 \\
		grid5rect(100,10)&   10 &        10 &           10  &      10 \\
       grid5recRotate(100,10,-45)&   18 &        10 &           10  &      10 \\
		gridt(40)        &   58 &        58 &           58  &      58 \\
		grid9(30)        &   88 &        92 &           104 &      88 \\
		Smallmesh        &   25 &        13 &           12  &      30 \\
		Tapir            &   55 &        34 &           18  &      49 \\
		Eppstein         &   42 &        48 &           45  &      45 \\  \hline \hline
	\end{tabular}
	\label{table:bisection}
\end{table}


\begin{table}[h]
	\caption{Edge-cut results for recursive bi-partitioning (data for $n=8$ on the left and $n=16$ on the right).}
	\centering
	\begin{tabular}{|l|r|r|r|r|p{4cm}|} \hline\hline
		Case & Spectral & Metis 5.0.2 & Coordinate & Inertial \\ \hline
		airfoil1 & 327\hfill578 & 320\hfill563 & 516\hfill819 & 577\hfill897\\
		3elt & 372\hfill671 & 395\hfill651 & 733\hfill1168 & 880\hfill1342\\
		barth4 & 505\hfill758 & 405\hfill689 & 875\hfill1306 & 891\hfill1350\\
		mesh3e1 & 72\hfill111 & 75\hfill117 & 75\hfill122 & 67\hfill102\\
		crack & 804\hfill1303 & 784\hfill1290 & 1343\hfill1860 & 1061 \hfill 1618\\\hline\hline
	\end{tabular}
	\label{table:Rec_bisection}
\end{table}


\begin{table}[h]
\caption{Comparing the number of cut edges for recursive bisection and direct multiway partitioning in Metis 5.0.2.}
\centering
\begin{tabular}{|l|r|r|r|r|} \hline\hline
Partitions       &   crack          & airfoil1  \\ \hline
 16              &                       &             \\
 32              &                       &             \\ \hline \hline
\end{tabular}
\label{table:Compare_Metis}
\end{table}



\end{document}
