summaryrefslogtreecommitdiffstats
path: root/answer_sheet/main.tex
diff options
context:
space:
mode:
diffstat (limited to 'answer_sheet/main.tex')
-rw-r--r--answer_sheet/main.tex32
1 files changed, 32 insertions, 0 deletions
diff --git a/answer_sheet/main.tex b/answer_sheet/main.tex
index 002a755..67e2b09 100644
--- a/answer_sheet/main.tex
+++ b/answer_sheet/main.tex
@@ -98,5 +98,37 @@ Our algorithm is then as follows;
98 98
99The cycle checking step, step 2 in the algorithm above uses the Union Find. Since we did not go into the detail of Union Find in the lectures we will use the naive approach which uses $\mathcal{O}(n^{2})$ operations. On top of that, we have to run Kruskal's algorithm twice for $T_{r}$ and $T_{w}$ which runs in order $\mathcal{O}(k\log(n))$ ($k$ can be substituted with the number of white edges, if higher). Overall, the runtime of the algorithm is $\mathcal{O}(n^{2} k\log(n))$. 99The cycle checking step, step 2 in the algorithm above uses the Union Find. Since we did not go into the detail of Union Find in the lectures we will use the naive approach which uses $\mathcal{O}(n^{2})$ operations. On top of that, we have to run Kruskal's algorithm twice for $T_{r}$ and $T_{w}$ which runs in order $\mathcal{O}(k\log(n))$ ($k$ can be substituted with the number of white edges, if higher). Overall, the runtime of the algorithm is $\mathcal{O}(n^{2} k\log(n))$.
100 100
101\section{Shortest-paths and min spanning trees}%
102\label{sec:shortest_paths_and_min_spanning_trees}
103
104\subsection{a}%
105\label{sub:a}
106
107We will assume the tree of shortest paths is a spanning tree (otherwise node $s$ on its own is a tree and the answer is trivial).
108
109For a graph $G = (V, E)$, we can have $T = (V, E')$ which is a tree of shortest paths and a minimum spanning tree $T' = (V, E'')$. Take any edge incident to $s$ and call it $k$. $k = (s, x)$ is the minimum weighted edge from $s$ to $x$ per definition of the tree of shortest paths. Suppose that the MST $T'$ does not include $k$. This implies that there exists a path in $T'$ $s \leadsto x$ that does not include $k$. Adding $k$ to the MST will introduce a cycle but we can break this cycle by using the Cycle property given in the Greedy Algorithms II lecture notes. Since $k = (s, x)$ is the minimum weighted edge, it will not get deleted which means MST should have included $k$ to begin with.
110
111So it is not possible for a tree of shortest paths and a MST to not share any edges.
112
113\[\begin{tikzcd}
114 {x} \\
115 {s} \\
116 & {S}
117 \arrow[from=2-1, to=3-2, dashed, no head]
118 \arrow[from=3-2, to=1-1, curve={height=24pt}, no head]
119 \arrow["{k}"', from=1-1, to=2-1, no head]
120\end{tikzcd}\]
121
122
123\subsection{b}%
124\label{sub:b}
125
126Given the acyclic digraph $G = (V, E)$ and an arborescence $A \subset E$ with the given conditions in the question text, $A$ itself is then a minimum cost arborescence in $G$. Take any $e = (v, t) \in A$. If $e$ is part of some minimum cost arborescence in $G$ then it is the cheapest incoming edge for $t$ per the lecture notes. $A$ is built up from such $e$ and the algorithm for building an arborescence in $G$ per the lecture notes is picking the cheapest incoming edge for every node and the graph $G$ is acyclic meaning that we cannot form accidental cycles by including every $e \in E$, $A$ is a minimum-cost arborescence in $G$.
127
128
129
130
131
132
101 133
102\end{document} 134\end{document}