Skip to content

Commit 000de66

Browse files
committedMar 22, 2012
added
1 parent c617e81 commit 000de66

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed
 

‎chapter25/25_1.tex

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
\subsection*{Problem 25-1 Transitive closure of a dynamic graph}
2+
\begin{enumerate}
3+
\item Let the edge $(u, v)$ is inserted into $G$. For all $i, j \in V$, if $t_{iu} \bigwedge t_{vj} = 1$, then we have $t_{ij} = 1$ \\
4+
The running time is $\mathcal{O}(V^2)$
5+
\item Consider a example, the original graph is a chain, i.e. $G: v_1 \rightarrow v_2 \rightarrow ... \rightarrow v_n$. The matrix of the connectivity $T$ is a upper-triangular matrix. Now we insert an edge $(v_n, v_1)$, then the matrix of the connectivity $T$ is an all one matrix. The changing value is at least $\Omega(V^2)$. \\
6+
Therefore, a graph $G$ and an edge $e$ such that $\Omega(V^2)$ time is required to update the transitive closure after the insertion of $e$ into $G$, no matter what algorithm is used.
7+
\item The algorithm:
8+
\begin{codebox}
9+
\Procname{$\proc{Insert}(u, v)$}
10+
\li \For $i \gets 1$ \To $\abs{V}$
11+
\Do
12+
\li \If $t_{iu} = 1$ and $t_{iv} = 0$
13+
\Then
14+
\li \For $j \gets 1$ \To $\abs{V}$
15+
\Do
16+
\li \If $t_{vj} = 1$
17+
\Then
18+
\li $t_{ij} \gets 1$;
19+
\End
20+
\End
21+
\End
22+
\End
23+
24+
\end{codebox}
25+
Since the condition of $t_{iv} = 0$ is true at most $\mathcal{O}(V^2)$ times, therefore, the running time of the algorithm is $\mathcal{O}(V^3)$
26+
\end{enumerate}
27+

‎chapter25/25_2.tex

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
\subsection*{Problem 25-2 Shortest paths in $\epsilon$-dense graphs}
2+
\begin{enumerate}
3+
\item In a $d$-ary min-heap, the asymptotic running time of \\
4+
Insert: $\Theta(\log_d{n})$ \\
5+
Extract-Min: $\Theta(d\log_d{n})$ \\
6+
Decrease-Key: $\Theta(\log_d{n})$ \\ \\
7+
If we choose $d = \Theta(n^\alpha)$ or some constant $0 < \alpha \leq 1$, the asymptotic running time of \\
8+
Insert: $\Theta(\frac{1}{\alpha})$ \\
9+
Extract-Min: $\Theta(\frac{d}{\alpha}) = \Theta(\frac{n^\alpha}{\alpha})$ \\
10+
Decrease-Key: $\Theta(\frac{1}{\alpha})$
11+
\item $d = V^\epsilon$
12+
\item To solve the all-pairs shortest-paths problem on an $\epsilon$-dense directed graph $G = (V, E)$ with no negative-weight edges, we can run $\abs{V}$ times Dijkstra's algorithms described above, the total running time of the algorithm is $\mathcal{O}(VE)$
13+
\item Using Johnson's algorithm to reweight the graph $G = (V, E)$, and then execute the above algorithm. The running time of the algorithm is $\mathcal{O}(VE + VE) = \mathcal{O}(VE)$
14+
\end{enumerate}
15+

0 commit comments

Comments
 (0)
Please sign in to comment.