\documentclass[12pt]{article}

\usepackage{graphicx}
\usepackage{amsmath,amssymb}
\usepackage{bbm}
\usepackage[hyphens]{url}
\usepackage{hyperref}


\newfont{\bssdoz}{cmssbx10 scaled 1200}
\newfont{\bssten}{cmssbx10}


\oddsidemargin  0in \evensidemargin 0in \topmargin -0.5in
\headheight 0.25in \headsep 0.25in
\textwidth   6.5in \textheight 9in %\marginparsep 0pt \marginparwidth 0pt
\parskip 1.5ex  \parindent 0ex \footskip 20pt

\begin{document}
\parindent 0ex
\thispagestyle{empty} \vspace*{-0.75in}
{\bssdoz CME 323: Distributed Algorithms and Optimization}
{\\ \bssten Instructor: Reza Zadeh (rezab@stanford.edu) }
{\\ \bssten HW\#2}
\vspace{5pt}

\begin{enumerate}

\item Using the Spark distribution and data you downloaded in hw1, follow the step by step instructions at the following URL:\\
{\scriptsize  \url{https://databricks-training.s3.amazonaws.com/movie-recommendation-with-mllib.html}}

\textbf{Note:} To get the examples to run, you must first replace the file  \\
\verb|machine-learning/scala/build.sbt| in your Spark distribution with the one from the following link:

{\scriptsize  \url{https://web.stanford.edu/~rezab/dao/hw/build.sbt}}

Now, answer the following questions:
\begin{enumerate}
\item Set the rank to 8, and print the factor for the movie ``Saving Private Ryan (1998)"
\item Set the rank to 5, and print the factor for the movie  ``Alien (1979)"
\end{enumerate}
Submit your code and answers.


\item Using the Spark distribution and data you already downloaded in hw1, follow the step by step instructions at the following URL, skipping to section 4.1 in the tutorial:\\
{\scriptsize  \url{https://databricks-training.s3.amazonaws.com/graph-analytics-with-graphx.html#getting-started-again}}

Go to section 4.1 in the tutorial, and answer the following questions:
\begin{enumerate}
\item What are websites with the top 10 pageranks in the wikipedia dataset?
\item What are websites with the top 10 indegrees in the wikipedia dataset?
\end{enumerate}
Submit your code and answers.


\item Give the pseudocode for finding the shortest path between a given source and a destination using
the Pregel paradigm. Assume each vertex has a unique ID and each edge has a weight of 1.






\end{enumerate}

\end{document}
