diff options
-rw-r--r-- | main.pdf | bin | 182748 -> 199456 bytes | |||
-rw-r--r-- | main.tex | 36 | ||||
-rw-r--r-- | structure.tex | 3 |
3 files changed, 38 insertions, 1 deletions
Binary files differ | |||
@@ -22,6 +22,8 @@ | |||
22 | \author{Yiğit Sever} | 22 | \author{Yiğit Sever} |
23 | \date{\today} | 23 | \date{\today} |
24 | 24 | ||
25 | \addbibresource{mylib.bib} | ||
26 | |||
25 | %---------------------------------------------------------------------------------------- | 27 | %---------------------------------------------------------------------------------------- |
26 | 28 | ||
27 | \begin{document} | 29 | \begin{document} |
@@ -80,8 +82,40 @@ A modified graph traversal using either BFS or DFS (since a node can be discover | |||
80 | 82 | ||
81 | With the assumption that accessing the labels $(u, w)$ takes $\mathcal{O}(1)$ time this algorithm has the same running time as BFS; $\mathcal{O}(m+n)$. | 83 | With the assumption that accessing the labels $(u, w)$ takes $\mathcal{O}(1)$ time this algorithm has the same running time as BFS; $\mathcal{O}(m+n)$. |
82 | 84 | ||
83 | |||
84 | \section{Reachability}% | 85 | \section{Reachability}% |
85 | \label{sec:reachability} | 86 | \label{sec:reachability} |
86 | 87 | ||
88 | First, compute all strongly connected components (SCCs) of $G$ by using~\parencite{tarjanDepthFirst1972} per \emph{page 72} of the \nth{3} lecture notes in $\mathcal{O}(E+V)$ time. Instead of labelling the SCCs with the root node, we will initially label all nodes of the SCC $F'$ with the $min(u)$ of the connected component. | ||
89 | |||
90 | Then, by ignoring the tree edges, shrink the graph $G$ such that $E' = {(v, w)~|~v \in F', w \in F''}$, leaving only cross links behind. This step takes another $\mathcal{O}(E+V)$ time. | ||
91 | |||
92 | Now run the topological sort algorithm presented in \emph{page 84} of the \nth{3} lecture notes this operation is yet again $\mathcal{O}(E+V)$. | ||
93 | |||
94 | Finally, reverse the direction of the edges on the graph that have been output by the topological sort and starting from the new root node, traverse the graph downwards and update the $min(u)$ of every SCC as follows; | ||
95 | |||
96 | {\centering | ||
97 | \begin{minipage}{.7\linewidth} | ||
98 | \begin{algorithm}[H] | ||
99 | \DontPrintSemicolon{} | ||
100 | \SetAlgoLongEnd{} | ||
101 | \KwData{$G'$ = topological sorted G with reversed edges} | ||
102 | \KwResult{$\min(u)$ for all vertices $u \in V$} | ||
103 | $\text{mostmin} \longleftarrow \min(\text{root})$\; | ||
104 | \While{traversing $G'$ downwards with current node $v$}{ | ||
105 | \uIf{$\min(v) < mostmin$}{ | ||
106 | $\text{mostmin} \longleftarrow \min(v)$\; | ||
107 | } | ||
108 | \Else{ | ||
109 | label $v$ as $mostmin$ | ||
110 | } | ||
111 | } | ||
112 | \caption{Updating $\min(u)$ of the SCCs}% | ||
113 | \label{alg:question_2} | ||
114 | \end{algorithm} | ||
115 | \end{minipage} | ||
116 | \par | ||
117 | } | ||
118 | |||
119 | \printbibliography | ||
120 | |||
87 | \end{document} | 121 | \end{document} |
diff --git a/structure.tex b/structure.tex index 5f53a93..c504c76 100644 --- a/structure.tex +++ b/structure.tex | |||
@@ -35,6 +35,9 @@ | |||
35 | \usepackage[super]{nth} | 35 | \usepackage[super]{nth} |
36 | \usepackage{caption} | 36 | \usepackage{caption} |
37 | \usepackage{tikz} | 37 | \usepackage{tikz} |
38 | \usepackage[style=authoryear]{biblatex} | ||
39 | |||
40 | |||
38 | 41 | ||
39 | \lstset{ | 42 | \lstset{ |
40 | basicstyle=\ttfamily, % Typeset listings in monospace font | 43 | basicstyle=\ttfamily, % Typeset listings in monospace font |