mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-26 06:48:04 +02:00
added a graph example
This commit is contained in:
parent
414cf2bbf1
commit
6a83b6e93d
4 changed files with 48 additions and 28 deletions
|
@ -1,7 +1,9 @@
|
||||||
\subsection{Idea}
|
\subsection{Idea}
|
||||||
\begin{frame}{Basics of PageRank}
|
\begin{frame}{Basics of PageRank}
|
||||||
|
We all know that:
|
||||||
\begin{itemize}[<+->]
|
\begin{itemize}[<+->]
|
||||||
\item Humans know what is good for them
|
\item Humans know what is good for them
|
||||||
|
\item[\xmark] Machines don't know what's good for humans
|
||||||
\item Humans create Websites
|
\item Humans create Websites
|
||||||
\item Humans will only \href{http://en.wikipedia.org/wiki/Hyperlink}{link} to Websites they like
|
\item Humans will only \href{http://en.wikipedia.org/wiki/Hyperlink}{link} to Websites they like
|
||||||
\item[$\Rightarrow$] Hyperlinks are a quality indicator
|
\item[$\Rightarrow$] Hyperlinks are a quality indicator
|
||||||
|
@ -12,8 +14,8 @@
|
||||||
\begin{itemize}[<+->]
|
\begin{itemize}[<+->]
|
||||||
\item Simply count number of links to a Website
|
\item Simply count number of links to a Website
|
||||||
\item[\xmark] 10,000 links from only one page
|
\item[\xmark] 10,000 links from only one page
|
||||||
\item Count numbers of Websites that link to a Website
|
\item Count number of Websites that link to a Website
|
||||||
\item[\xmark] Quality of the page matters
|
\item[\xmark] Quality of the linking website matters
|
||||||
\item[\xmark] Total number of links on the source page matters
|
\item[\xmark] Total number of links on the source page matters
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
@ -42,21 +44,28 @@
|
||||||
\end{algorithmic}
|
\end{algorithmic}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
\begin{frame}{Ants}
|
\begin{frame}{What is PageRank?}
|
||||||
\begin{itemize}[<+->]
|
The PageRank algorithm calculates the probability of a randomly
|
||||||
\item Websites = nodes = anthill
|
clicking user ending up on a given page.
|
||||||
\item Links = edges = paths
|
|
||||||
\item You place ants on each node
|
|
||||||
\item They walk over the paths
|
|
||||||
\item[] (at random, they are ants!)
|
|
||||||
\item After some time, some anthills will have more ants than
|
|
||||||
others
|
|
||||||
\item Those hills are more attractive than others
|
|
||||||
\item \# ants is probability that a random user would end on
|
|
||||||
a website
|
|
||||||
\end{itemize}
|
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
|
\input{Animation}
|
||||||
|
|
||||||
|
%\begin{frame}{Ants}
|
||||||
|
% \begin{itemize}[<+->]
|
||||||
|
% \item Websites = nodes = anthill
|
||||||
|
% \item Links = edges = paths
|
||||||
|
% \item You place ants on each node
|
||||||
|
% \item They walk over the paths
|
||||||
|
% \item[] (at random, they are ants!)
|
||||||
|
% \item After some time, some anthills will have more ants than
|
||||||
|
% others
|
||||||
|
% \item Those hills are more attractive than others
|
||||||
|
% \item \# ants is probability that a random user would end on
|
||||||
|
% a website
|
||||||
|
% \end{itemize}
|
||||||
|
%\end{frame}
|
||||||
|
|
||||||
\begin{frame}{Mathematics}
|
\begin{frame}{Mathematics}
|
||||||
Let $x$ be a web page. Then
|
Let $x$ be a web page. Then
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
|
@ -72,19 +81,19 @@
|
||||||
\begin{frame}{Pseudocode}
|
\begin{frame}{Pseudocode}
|
||||||
\begin{algorithmic}
|
\begin{algorithmic}
|
||||||
\alertline<1> \Function{PageRank}{Graph $web$, double $q=0.15$, int $iterations$} %q is a damping factor
|
\alertline<1> \Function{PageRank}{Graph $web$, double $q=0.15$, int $iterations$} %q is a damping factor
|
||||||
\alertline<2> \ForAll{$page \in web$}
|
%\alertline<2> \ForAll{$page \in web$}
|
||||||
\alertline<3> \State $page.pageRank = \frac{1}{|web|}$ \Comment{intial probability}
|
%\alertline<3> \State $page.pageRank = \frac{1}{|web|}$ \Comment{intial probability}
|
||||||
\alertline<2> \EndFor
|
%\alertline<2> \EndFor
|
||||||
|
|
||||||
\alertline<4> \While{$iterations > 0$}
|
\alertline<2> \While{$iterations > 0$}
|
||||||
\alertline<5> \ForAll{$page \in web$} \Comment{calculate pageRank of $page$}
|
\alertline<3> \ForAll{$page \in web$} \Comment{calculate pageRank of $page$}
|
||||||
\alertline<6> \State $page.pageRank = q$
|
\alertline<4> \State $page.pageRank = q$
|
||||||
\alertline<7> \ForAll{$y \in L(page)$}
|
\alertline<5> \ForAll{$y \in L(page)$}
|
||||||
\alertline<8> \State $page.pageRank$ += $\frac{y.pageRank}{C(y)}$
|
\alertline<6> \State $page.pageRank$ += $\frac{y.pageRank}{C(y)}$
|
||||||
\alertline<7> \EndFor
|
\alertline<5> \EndFor
|
||||||
\alertline<5> \EndFor
|
\alertline<3> \EndFor
|
||||||
\alertline<4> \State $iterations$ -= $1$
|
\alertline<2> \State $iterations$ -= $1$
|
||||||
\alertline<4> \EndWhile
|
\alertline<2> \EndWhile
|
||||||
\alertline<1> \EndFunction
|
\alertline<1> \EndFunction
|
||||||
\end{algorithmic}
|
\end{algorithmic}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
Binary file not shown.
|
@ -1,4 +1,4 @@
|
||||||
\documentclass[usepdftitle=false]{beamer}
|
\documentclass[hyperref={pdfpagelabels=false},usepdftitle=false]{beamer}
|
||||||
\usepackage{../templates/myStyle}
|
\usepackage{../templates/myStyle}
|
||||||
|
|
||||||
\begin{document}
|
\begin{document}
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
\usepackage[english]{babel} % this is needed for german umlauts
|
\usepackage[english]{babel} % this is needed for german umlauts
|
||||||
\usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf
|
\usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf
|
||||||
\usepackage{verbatim}
|
\usepackage{verbatim}
|
||||||
|
\usepackage{tikz}
|
||||||
|
\usetikzlibrary{arrows,shapes}
|
||||||
\usepackage{relsize}
|
\usepackage{relsize}
|
||||||
\usepackage{subfigure}
|
\usepackage{subfigure}
|
||||||
\usepackage{algorithm,algpseudocode}
|
\usepackage{algorithm,algpseudocode}
|
||||||
|
@ -22,6 +24,15 @@
|
||||||
\usepackage{soul}
|
\usepackage{soul}
|
||||||
\usepackage{algorithm,algpseudocode}
|
\usepackage{algorithm,algpseudocode}
|
||||||
|
|
||||||
|
% Define some styles for graphs
|
||||||
|
\tikzstyle{vertex}=[circle,fill=black!25,minimum size=20pt,inner sep=0pt]
|
||||||
|
\tikzstyle{selected vertex} = [vertex, fill=red!24]
|
||||||
|
\tikzstyle{blue vertex} = [vertex, fill=blue!24]
|
||||||
|
\tikzstyle{edge} = [draw,thick,-]
|
||||||
|
\tikzstyle{weight} = [font=\small]
|
||||||
|
\tikzstyle{selected edge} = [draw,line width=5pt,-,red!50]
|
||||||
|
\tikzstyle{ignored edge} = [draw,line width=5pt,-,black!20]
|
||||||
|
|
||||||
%\algdef{SE}[IF]{NoThenIf}{EndIf}[1]{\algorithmicif\ #1\textbf{:}}{\algorithmicend\ \algorithmicif}%
|
%\algdef{SE}[IF]{NoThenIf}{EndIf}[1]{\algorithmicif\ #1\textbf{:}}{\algorithmicend\ \algorithmicif}%
|
||||||
\algtext*{EndIf} % Remove "end if" text
|
\algtext*{EndIf} % Remove "end if" text
|
||||||
\algtext*{EndWhile} % Remove "end while" text
|
\algtext*{EndWhile} % Remove "end while" text
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue