mp2: added template

This commit is contained in:
Claudio Maggioni 2020-09-29 13:58:49 +02:00
parent a91194c78a
commit 4cd35f229d
14 changed files with 1809 additions and 0 deletions

14
mp2/Makefile Normal file
View file

@ -0,0 +1,14 @@
filename=template
pdf:
pdflatex ${filename}
bibtex ${filename}||true
pdflatex ${filename}
make clean
read:
evince ${filename}.pdf &
clean:
rm -f *.out *.log *.bbl *.blg *.aux ${filename}.log ${filename}.ps ${filename}.aux ${filename}.out ${filename}.dvi ${filename}.bbl ${filename}.blg

Binary file not shown.

View file

@ -0,0 +1,43 @@
%
% On a Matrix and Its Graph
%
% At the 1993 Householder Symposium on Numerical Algebra in Lake Arrowhead,
% Nick Trefethen posted a flip chart and invited everyone present to write
% their name on it, and to draw lines connecting their name with the names
% of all their coauthors. The diagram grew denser throughout the week; at
% the end it was a graph with 104 vertices (or people) and 211 edges.
%
% A graph is a sparse matrix, so just for fun we typed the graph into Matlab
% and looked at it in a few different ways. You can say "runme" to Matlab
% to see the results.
%
% The original flip chart is now framed on the wall of Nick's office at
% Cornell. He promises to bring it along to Householder 2023.
%
% - John Gilbert, Cleve Moler, Nick Trefethen
% with thanks to Rob Schreiber, Barry Smith, and 99 others.
%
% ----------------------------------------------------------------------
% List of files in matlab/householder:
%
% README.m This file.
%
% runme.m Matlab script to show off the matrix and the graph.
%
% drawit.m Matlab script just to draw the graph.
%
% graph.ps Black-and-white postscript picture of the graph.
%
% housegraph.mat The raw data, as follows:
%
% A is the 104x104 adjacency matrix of the graph.
% xy is the array of vertex coordinates for the picture.
% name is a character matrix with 104 rows, each row giving the
% name of the person associated with a vertex.
% Every person's name is also a scalar variable whose value is
% that person's vertex number; for example,
% Stewart = 77 and name(77,:) = 'Stewart'.
% prcm is a permutation (based on reverse Cuthill-McKee)
% to reorder the graph for the picture.
help README

View file

@ -0,0 +1,28 @@
% DRAWIT Script to plot the graph of coauthors from Householder 93.
if ~exist('prcm')
load housegraph;
end;
% A is the adjacency matrix.
% prcm is a permutation; any permutation could be substituted.
% name is the vector of people's names.
% xy is just xy coords of points on the unit circle (and the origin).
Aperm = A(prcm,prcm);
nameperm = name(prcm,:);
nfolks = max(size(A));
clf
gplot(Aperm,xy);
axis off;
x = xy(:,1) * 1.05;
y = xy(:,2) * 1.05;
x(1) = .08; % Put names(1) in the center of the circle.
y(1) = .06;
h = text(x,y,nameperm);
for k = 2:nfolks % Shrink the font for the other names, and rotate them.
set(h(k),'fontsize',10);
set(h(k),'rotation',180/pi*atan2(y(k),x(k)));
end;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,190 @@
% RUNME : Demonstrate the graph of coauthors from Householder 1993.
load housegraph;
% A is the adjacency matrix.
% prcm is a permutation; any permutation could be substituted.
% name is the vector of people's names.
% xy is just xy coords of points on the unit circle (and the origin).
clc;
more off;
format compact;
disp(' ');
disp(' On a Matrix and Its Graph');
disp(' ');
disp('At the 1993 Householder Symposium on Numerical Algebra in Lake Arrowhead,');
disp('Nick Trefethen posted a flip chart and invited everyone present to write');
disp('their name on it, and to draw lines connecting their name with the names');
disp('of all their coauthors. The diagram grew denser throughout the week; at');
disp('the end it was a graph with 104 vertices (or people) and 211 edges. ');
disp(' ');
disp('Just for fun we typed the graph into Matlab. Here''s the result....');
disp(' ');
disp(' [Hit space to continue] ');
pause;
figure(1);
clf reset;
spy(A);
title('Coauthor Matrix');
drawnow;
figure(2);
clf reset;
drawit;
disp(' ');
disp('The adjacency matrix is symmetric with 104 rows and columns, and');
disp('211 nonzeros above the diagonal; all the nonzeros have value 1. ');
disp(' ');
disp(' [Hit space to continue] ');
pause;
disp(' ');
disp('Which column has the highest nonzero count?');
disp(' ');
echo on
[count,column] = max(sum(A))
name(column,:)
echo off
disp(' ');
disp(' [Hit space to continue] ');
pause;
clc;
disp('Here''s a bandwidth-reducing order of the matrix. ');
p = symrcm(A);
figure(1);
spy(A(p,p));
title('Reverse Cuthill-McKee Order');
drawnow;
disp(' ');
disp('I don''t know what to conclude from this!');
disp(' ');
disp(' [Hit space to continue] ');
pause;
clc;
disp('Powers of the matrix give information about paths in the graph.');
disp('Squaring the matrix gives paths of length 1 and 2.');
figure(1);
AA = A^2;
spy(AA);
title('A^2');
disp(' ');
disp(' [Hit space to continue] ');
pause;
disp(' ');
disp('Have Gene Golub and Cleve Moler ever been coauthors?');
disp(' ');
disp(' [Hit space to continue] ');
pause;
disp(' ');
echo on;
A(Golub,Moler)
echo off;
disp(' ');
disp('No.');
disp('But how many coauthors do they have in common?');
disp(' ');
disp(' [Hit space to continue] ');
pause;
disp(' ');
echo on;
AA = A^2;
AA(Golub,Moler)
echo off;
disp(' ');
disp('And who are those common coauthors? (Matlab hackers raise your hands.)');
disp(' ');
disp(' [Hit space to continue] ');
pause;
disp(' ');
echo on;
name( find ( A(:,Golub) .* A(:,Moler) ), :)
echo off;
disp(' ');
disp(' [Hit space to continue] ');
pause;
clc;
disp('If we keep taking powers of the matrix, ...');
p = 2;
while ~all(AA(1,:))
AA = AA*A;
spy(AA);
p = p+1;
title(['A^' int2str(p)]);
pause(1);
end;
disp(' ');
disp('... we can find the length of the longest path ');
disp('from Gene Golub to anybody, which is the power that');
disp('first has row 1 full, ...');
disp(' ');
disp(' [Hit space to continue] ');
pause;
disp(' ');
while ~all(all(AA))
AA = AA*A;
spy(AA);
p = p+1;
title(['A^' int2str(p)]);
pause(1);
end;
disp('... and also the diameter of the graph, which is ');
disp('the power that first has the whole matrix full.');
disp(' ');
disp(' [Hit space to continue] ');
pause;
clc;
disp(' ');
disp('Finally, we try a minimum degree reordering of the matrix');
disp('and discover its true nature as, of course, ....');
disp(' ');
p = symamd(A);
spy(A(p,p));
title('The (Lake) Arrowhead Matrix');
pause(8);
disp(' ');
disp('Thanks to Tony Chan and Gene Golub for the meeting,');
disp(' Rob Schreiber and Barry Smith for helping count edges,');
disp(' and all concerned for a wonderful week.');
disp(' - John Gilbert, Cleve Moler, and Nick Trefethen ');
disp(' ');

View file

@ -0,0 +1,34 @@
0 1 1 1 1 1 1 1 1 0 1 1 1 1 0 0 0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 0 0 0 0 0 0 0 0 0 0 0 1 1
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 1 1
0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 1 0 1 0 1 1 0 0 0 0 0 1 1 1 0 1
0 0 0 0 0 0 0 0 1 1 0 0 0 1 1 1 0 0 1 1 1 0 1 1 0 0 1 1 1 1 1 1 1 0

View file

@ -0,0 +1,65 @@
function x = pagerank(U,G,p)
% PAGERANK Google's PageRank
% pagerank(U,G,p) uses the URLs and adjacency matrix produced by SURFER,
% together with a damping factory p, (default is .85), to compute and plot
% a bar graph of page rank, and print the dominant URLs in page rank order.
% x = pagerank(U,G,p) returns the page ranks instead of printing.
% See also SURFER, SPY.
if nargin < 3, p = .85; end
if(ischar(U))
U=cellstr(U);
end
if(isreal(U))
U=(num2cell(U));
end
% Eliminate any self-referential links
G = G - diag(diag(G));
% c = out-degree, r = in-degree
n = size(G,1);
c = sum(G,1);
r = sum(G,2);
% Scale column sums to be 1 (or 0 where there are no out links).
k = find(c~=0);
D = sparse(k,k,1./c(k),n,n);
% Solve (I - p*G*D)*x = e
e = ones(n,1);
I = speye(n,n);
x = (I - p*G*D)\e;
% Normalize so that sum(x) == 1.
x = x/sum(x);
% Bar graph of page rank.
shg
bar(x)
title('Page Rank')
% Print URLs in page rank order.
if nargout < 1
[~,q] = sort(-x);
disp(' page-rank in out url')
k = 1;
while (k <= n) && (x(q(k)) >= .005)
j = q(k);
temp1 = r(j);
temp2 = c(j);
fprintf(' %3.0f %8.4f %4.0f %4.0f %s\n', j,x(j),full(temp1),full(temp2),U{j})
k = k+1;
end
end

View file

@ -0,0 +1,27 @@
clear;
n = 1000;
x = randperm(n);
gs = 450;
group1 = x(1:gs);
group2 = x(gs+1:end);
p_group1 = 0.5;
p_group2 = 0.4;
p_between = 0.1;
A(group1, group1) = rand(gs, gs) < p_group1;
A(group2, group2) = rand(n-gs, n-gs) < p_group2;
A(group1, group2) = rand(gs, n-gs) < p_between;
% no group2, group1 needed since we'll force the matrix to be symmetric
A = triu(A,1); % upper triangular part of A without diagonal
A = A + A'; % make it symmetric
deg = sum(A);
L = diag(deg) - A;
[V, D] = eig(L);
display(D(2,2));
plot(sort(V(:,2)), '.-');
[ignore, p] = sort(V(:,2));
spy(A(p,p));

322
mp2/assignment.sty Normal file
View file

@ -0,0 +1,322 @@
%% % for readable pdf files
%% \usepackage{times}
\usepackage{ifthen}
\usepackage{comment}
\usepackage[utf8]{inputenc}
%% \usepackage{enumerate}
%% \usepackage{alltt}
%% \usepackage{xspace}
%% \usepackage{wrapfig}
\usepackage{graphics}
\usepackage{graphicx}
\usepackage{epstopdf}
% \usepackage{amsmath}
%% \usepackage{mathtools}
\usepackage{amssymb}
%\usepackage[xetex,bookmarks,pdfencoding=unicode,colorlinks=true,citecolor=blue,linkcolor=black,urlcolor=blue]{hyperref}
\usepackage[bookmarks,pdfencoding=unicode,colorlinks=true,citecolor=blue,linkcolor=black,urlcolor=blue]{hyperref}
% \usepackage{nohyperref}
%\usepackage{url}
%% \usepackage{fancyvrb}
\usepackage{verbatim}
\usepackage{listingsutf8}
\usepackage{color}
%% \usepackage{textcomp}
%% \usepackage{cmap}
%% \usepackage[colorinlistoftodos]{todonotes}
%% \usepackage{lineno}
%% \usepackage{tocloft}
%% \usepackage{marginnote}
\usepackage{geometry}
\usepackage{booktabs}
%% \usepackage{longtable}
%% \usepackage{etoolbox}
%% \usepackage{titlesec}
\usepackage[font=small,labelfont=it,labelsep=period,justification=centering]{caption}
\usepackage{array}
%% %\usepackage{tabularx}
%% \usepackage[titletoc]{appendix}%
\pagestyle{plain}
\voffset -5mm
\oddsidemargin 0mm
\evensidemargin -11mm
\marginparwidth 2cm
\marginparsep 0pt
\topmargin 0mm
\headheight 0pt
\headsep 0pt
\topskip 0pt
%\footheight 0pt
%\footskip 0pt
\textheight 255mm
\textwidth 165mm
% ----------------------------------------
%
% II. Macros
%
% ----------------------------------------
\let\gaga=\phi \let\phi=\varphi \let\varphi=\gaga
\let\gaga=\theta \let\theta=\vartheta \let\vartheta=\gaga
\let\gaga=\epsilon \let\epsilon=\varepsilon \let\varepsilon=\gaga
\newcommand\code[1]{ {\footnotesize \texttt{#1}} }
\newcommand\isassignment {false}
\newcommand{\setassignment}{\renewcommand\isassignment {true}}
\newcommand{\ifassignment}[1]{\ifthenelse{\boolean{\isassignment}}{#1}{}}
\newcommand{\ifnotassignment}[1]{\ifthenelse{\boolean{\isassignment}}{}{#1}}
\newcommand{\ignore}[1]{}
\newcommand{\duedate} {}
\newcommand{\setduedate}[1]{%
\renewcommand\duedate {Due date:~ #1}
}
\newcommand{\assignmentpolicy}{
\bigskip
\bigskip
\begin{table}[h]
\begin{center}
\scalebox{0.8} {%
\begin{tabular}{|p{0.02cm}p{16cm}|}
\hline
&\\
\multicolumn{2}{|c|}{\Large\textbf{Submission instructions}}\\
\multicolumn{2}{|c|}{\large\textbf{(Please, notice that following instructions are mandatory: }}\\
\multicolumn{2}{|c|}{\large\textbf{submissions that don't comply with, won't be considered)}}\\
&\\
\textbullet & Assignments must be submitted to Moodle (i.e. in electronic format).\\
\textbullet & Provide both executable package (single .class or .jar file) and sources (.java files). If you are using non-sdk libraries, please add them in the file. Sources must be organized in packages called:\\
\multicolumn{2}{|c|}{\textit{ch.usi.inf.ncc12.assignment$<$assignmentNumber$>$.exercise$<$exerciseNumber$>$.$<$name$>$.$<$surname$>$}}\\
& and the jar file must be called:\\
\multicolumn{2}{|c|}{\textit{assignment$<$AssignmentNumber$>$.$<$Name$>$.$<$Surname$>$.jar}}\\
& Projects exported directly from Eclipse would be much appreciated (Please, be sure that you are including also the sources in the jar file).\\
\textbullet & The produced files (one pdf and one jar file) must be collected into a single archive file (.zip) named:\\
\multicolumn{2}{|c|}{\textit{assignment$<$AssignmentNumber$>$.$<$Name$>$.$<$Surname$>$.zip}}\\
\hline
\end{tabular}
}
\end{center}
\end{table}
}
\newcommand{\ie}{\textit{i.e.,}\xspace}
\newcommand{\eg}{\textit{e.g.,}\xspace}
\newcommand{\etal}{\textit{et al.}\xspace}
\newcommand\nat{{\Bbb N}}
\def\int{{\Bbb Z}}
\newcommand\rat{{\Bbb Q}}
\newcommand\real{{\Bbb R}}
\newcommand\calD{{\cal D}}
\newcommand\calM{{\cal M}}
\newcommand\calL{{\cal L}}
\newcommand\Gone{\bfmath{G1}}%
\newcommand\Gonei{\bfmath{G1i}}%
\newcommand\Goneai{\bfmath{G1(i)}}%
\newcommand\Gtwo{\bfmath{G2}}%
\newcommand\Gtwoi{\bfmath{G2i}}%
\newcommand\Gtwoai{\bfmath{G2(i)}}%
\newcommand\Gthree{\bfmath{G3}}%
\newcommand\Gthreei{\bfmath{G3i}}%
\newcommand\Gthreeai{\bfmath{G3(i)}}%
\newcommand\True{\bfmath{True}}
\newcommand\False{\bfmath{False}}
\newcommand\FV{\itmath{FV}}
%
% mathrel's
%
\def\maps{\mathrel{:}}
\def\andthen{\mathrel{;}}
\def\suchthat{\mathrel{:}}
\def\defid{\mathrel{:\equiv}}
\def\defeq{\mathrel{:=}}
\def\eqdef{\mathrel{=:}}
\def\gewenn{\leftrightarrow}
\newcommand\tnt{\mathrel{\supset}}
\newcommand\pr{\mathrel{\vdash}}%
\def\prld#1#2{\mathrel{\vrule width 0.3pt height 8pt depth 2pt\mkern-2mu\textstyle{\hskip0.5ex\raise2pt\hbox{$\scriptstyle#1$}\hskip0.1ex\over\hskip0.5ex#2\hskip0.1ex}}}
\def\defGewenn{\mathrel{{:}{\Longleftrightarrow}}}
\def\Gewenn{\mathrel{\Longleftrightarrow}}
\def\To{\mathrel{\Longrightarrow}}
\def\defsimeq{\mathrel{:\simeq}}
\def\redone{\mathrel{\vartriangleright_1}}
\def\red{\mathrel{\vartriangleright}}
%
% mathbin's
%
\newlength{\lminus}
\settowidth{\lminus}{\hbox{$-$}}
\def\dotmin{\mathbin{\vbox{\lineskip0pt\baselineskip0pt\hbox to\lminus{\hfill.\hfill}\vglue-0.55ex\hbox{$-$}}}}
%
% mathop's
%
\def\pow{\mathop{\rm Pow}}
\def\dom{\mathop{\rm dom}}
\def\ran{\mathop{\rm ran}}
\def\seq#1{\langle #1\rangle}
\def\Seq{\mathop{\it Seq}}
\def\lh{\mathop{\it lh}}
%
% points
%
\newcommand{\punkte}[1]{\hspace{1ex}\emph{\mdseries\hfill(#1~\ifcase#1{Points}\or{Points}\else{Points}\fi)}}
% ----------------------------------------------------------------------
\newcommand\secRule{\vspace{-4mm} \rule{.5\textwidth}{4pt}\vspace{-5mm}}
\newcommand{\vf}{\vspace{7mm plus7mm minus1mm}}
\newcommand{\compl}{{\rm c}}
\newcommand{\blank}{\hspace{0.5em}}
\newcommand\nyt{\rule{0pt}{0pt}}
\newcommand{\emspace}{\hspace{1em}}
\newcounter{countaufg}
\newenvironment{exercise}[1]{\addtocounter{countaufg}{1}%
\bigskip%
\subsection*{Exercise \arabic{countaufg} - %\series{m}
\selectfont #1%
\makeatother}%
\bigskip%
}
\newenvironment{optexercise}[1]{\addtocounter{countaufg}{1}%
\bigskip%
\subsection*{Exercise \arabic{countaufg} (optional) - %\series{m}
\selectfont #1%
\makeatother}%
\bigskip%
}%
\newcommand\hint[1]{\emph{Hint :} #1}
\newcommand\note[1]{\emph{Note :} #1}
\newcommand\serieheader[6]{
\thispagestyle{empty}%
\begin{flushleft}
\includegraphics[width=0.4\textwidth]{usi_inf}
\end{flushleft}
\noindent%
{\large\ignorespaces{\textbf{#1}}\hspace{\fill}\ignorespaces{ \textbf{#2}}}\\ \\%
{\large\ignorespaces #3 \hspace{\fill}\ignorespaces #4}\\
{\large\ignorespaces \empty{}\hspace{\fill}\ignorespaces \duedate}\\
\noindent%
\bigskip
\hrule\par\bigskip\noindent%
\bigskip {\ignorespaces {\Large{\textbf{#5}}}
\hspace{\fill}\ignorespaces \large \ifthenelse{\boolean{\isassignment}}{ }{\textbf{\Large }}}
\hrule\par\bigskip\noindent% \linebreak
}
\makeatletter
\def\enumerateMod{\ifnum \@enumdepth >3 \@toodeep\else
\advance\@enumdepth \@ne
\edef\@enumctr{enum\romannumeral\the\@enumdepth}\list
{\csname label\@enumctr\endcsname}{\usecounter
{\@enumctr}%%%? the following differs from "enumerate"
\topsep0pt%
\partopsep0pt%
\itemsep0pt%
%%%? end(differs)
\def\makelabel##1{\hss\llap{##1}}}\fi}
\let\endenumerateMod =\endlist
\makeatother
\usepackage{etex}
\usepackage{type1ec}
\usepackage[T2A]{fontenc}
\usepackage{textcomp}
%\usepackage[utf8]{inputenc}
%% \usepackage{polyglossia}
%% %\defaultfontfeatures{Scale=MatchLowercase, Mapping=tex-text}
%% \setmainfont[Scale=MatchLowercase, Mapping=tex-text]{Times New Roman}
%% \newfontfamily\cyrillicfont[Scale=MatchLowercase, Mapping=tex-text]{Times New Roman}
%% \setsansfont[Scale=MatchLowercase, Mapping=tex-text]{Times New Roman}
%% \setmonofont{Courier New}
%%
%% \setdefaultlanguage{english}
%% \selectlanguage{english}
\geometry{inner=25mm, outer=25mm, top=35mm, bottom=35mm, headheight=25mm, headsep=6.17mm}
\textwidth=0.8\paperwidth
\linespread{1.2}
%% \font\smallfont="Times New Roman" at 9 pt
%% \font\chapterfont="Times New Roman" at 16 pt
%% \font\chaptertitlefont="Times New Roman" at 18 pt
%% \font\sectionfont="Times New Roman Bold" at 11 pt
%% \font\subsectionfont="Times New Roman" at 11 pt
%% \font\headerfont="Times New Roman" at 9 pt
%% \font\headerboldfont="Times New Roman Bold" at 9 pt
%% \font\footerboldfont="Times New Roman Bold" at 10 pt
%% \titleformat{\chapter}[display]{\chapterfont}
%% {\chaptertitlename\ \thechapter}{18pt}{\chaptertitlefont}
%% \titleformat{\section}{\sectionfont}{\thesection.}{0.5em}{}
%% \titleformat{\subsection}{\subsectionfont}{\thesubsection.}{0.5em}{}
%% \titleformat{\subsubsection}{\subsectionfont}{\thesubsubsection.}{0.5em}{}
%% \titleformat{\figure}{}{\thefigure\.}{0.5em}{}
\usepackage{sectsty}
%% \font\smallfont="Times New Roman" at 9 pt
%% \font\chapterfont="Times New Roman" at 16 pt
\chapterfont{\fontsize{16}{20}\selectfont}
%% \font\chaptertitlefont="Times New Roman" at 18 pt
\chaptertitlefont{\fontsize{18}{22}\selectfont}
%% \font\sectionfont="Times New Roman Bold" at 11 pt
\sectionfont{\fontsize{11}{14}\selectfont}
%% \font\subsectionfont="Times New Roman" at 11 pt
\subsectionfont{\fontsize{9}{11}\selectfont}
%% \font\headerfont="Times New Roman" at 9 pt
%% \font\headerboldfont="Times New Roman Bold" at 9 pt
%% \font\footerboldfont="Times New Roman Bold" at 10 pt
%% \titleformat{\chapter}[display]{\chapterfont}
%% {\chaptertitlename\ \thechapter}{18pt}{\chaptertitlefont}
%% \titleformat{\section}{\sectionfont}{\thesection.}{0.5em}{}
%% \titleformat{\subsection}{\subsectionfont}{\thesubsection.}{0.5em}{}
%% \titleformat{\subsubsection}{\subsectionfont}{\thesubsubsection.}{0.5em}{}
%% \titleformat{\figure}{}{\thefigure\.}{0.5em}{}
\lstset{
inputencoding=utf8,
% backgroundcolor=\color{white},
tabsize=4,
rulecolor=,
basicstyle=\scriptsize,
upquote=true,
% aboveskip={1.5\baselineskip},
columns=fixed,
showstringspaces=false,
extendedchars=true,
breaklines=true,
prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
frame=single,
showtabs=false,
showspaces=false,
showstringspaces=false,
identifierstyle=\ttfamily,
keywordstyle=\ttfamily\color[rgb]{0,0,1},
commentstyle=\ttfamily\color[rgb]{0.133,0.545,0.133},
stringstyle=\ttfamily\color[rgb]{0.627,0.126,0.941},
}
% Add dots after chapters / sections numbers in TOC.
\makeatletter
\def\@seccntformat#1{\csname the#1\endcsname.\quad}
\def\numberline#1{\hb@xt@\@tempdima{#1\if&#1&\else.\fi\hfil}}
\makeatother
%% Define a new 'leo' style for the package that will use a smaller font.
\makeatletter
\def\url@leostyle{%
\@ifundefined{selectfont}{\def\UrlFont{\sf}}{\def\UrlFont{\small\ttfamily}}}
\makeatother
%% Now actually use the newly defined style.
\urlstyle{leo}

Binary file not shown.

View file

@ -0,0 +1,50 @@
\documentclass[unicode,11pt,a4paper,oneside,numbers=endperiod,openany]{scrartcl}
\input{assignment.sty}
\hyphenation{PageRank}
\hyphenation{PageRanks}
\begin{document}
\setassignment
\setduedate{Wednesday, 14 October 2020, 11:55 PM}
\serieheader{Numerical Computing}{2020}{Student: FULL NAME}{Discussed with: FULL NAME}{Solution for Project 2}{}
\newline
\assignmentpolicy
The purpose of this assignment\footnote{This document is originally
based on a blog from Cleve Moler, who wrote a fantastic blog post about the Lake Arrowhead graph, and John
Gilbert, who initially created the coauthor graph from the 1993 Householder Meeting. You can find more information
at \url{http://blogs.mathworks.com/cleve/2013/06/10/lake-arrowhead-coauthor-graph/}. Most of this assignment is derived
from this archived work.} is to learn the importance of sparse linear algebra algorithms to solve fundamental
questions in social network analyses.
We will use the coauthor graph from the Householder Meeting and the social network of friendships from Zachary's karate club~\cite{karate}.
These two graphs are one of the first examples where matrix methods were used in computational social network analyses.
\section{The Reverse Cuthill McKee Ordering [10 points]}
\section{Sparse Matrix Factorization [10 points]}
\section{Degree Centrality [10 points]}
\section{The Connectivity of the Coauthors [10 points]}
\section{PageRank of the Coauthor Graph [10 points]}
\section{Zachary's karate club: social network of friendships between 34 members [50 points]}
\begin{thebibliography}{99}
\bibitem{karate} The social network of a karate club at a US university, M.~E.~J. Newman and M. Girvan, Phys. Rev. E 69,026113 (2004)
pp. 219-229.
\end{thebibliography}
\end{document}

BIN
mp2/usi_inf.pdf Normal file

Binary file not shown.