\documentclass[11pt]{article}

\usepackage{fullpage}
\usepackage{graphicx,epsfig,color,amssymb}


\begin{document}

\title{{\bf Applications of graph traversal}\\
\normalsize{(CLRS 22.2, 22.3)}}


\date{}

\maketitle


\section*{Undirected graphs:} 

\subsection*{Concepts:} 

\begin{itemize}

\item paths, cycles 

\item connectivity

\item shortest paths

\item trees

\item spanning trees/ spanning forest
\end{itemize} 




\subsection*{Basic problems on undirected graphs:}

Briefly describe algorithms to answer the following questions, and
analyze the complexity of your algorithm. Assume the graph is given as
an adjacency list.

\begin{enumerate} 

\item Is $G$ connected?
\vspace{4cm}

\item How many  CCs are in $G$? 


\newpage 
\item Compute the connected components of $G$, label each vertex with
  the id of its CC

\vspace{5cm}


\item Given two vertices, are they in the same CC? 

\vspace{5cm}


\item Given two vertice $u,v$, find a path between $u$ and $v$

\vspace{5cm}


\item Does $G$ contain a cycle? 

\vspace{5cm}

\item Compute a spanning tree (forest) for $G$.

\vspace{4cm}
\item Is $G$ a tree? 
\vspace{4cm}

\item Assume $G$ is a connected undirected graph; given any two
  vertices $u,v$, find the shortest path between them.
\vspace{5cm}


\item Assume $G$ is a connected undirected graph with vertices
  $v_1,v_2,...,v_n$; describe how to compute a 2D-array
  $d[1..n][1..n]$ such that $d[i][j]$ represents the length (number of
  edges) of the shortest path from $v_i$ to $v_j$.  \vspace{5cm}

\newpage
\item All-pair connectivity: Given a graph, support queries of the
  form: are $u,v$ connected?  (a) with no-preprocessing, how fast can
  you answer a query?; (b) Pre-process the graph into an approptiate
  data structure in order to answer connectivity queries in $O(1)$
  time.  \vspace{8cm}

\item All-pair shortest paths: Given a graph, support queries of the
  form: find the shortest path from $u$ to $v$. (a) no -preprecessing;
  (b) Describe how a graph can be pre-processed in order to answer
  shortest path queries in $O(1)$ time.  \vspace{8cm}

\newpage
\item Two-colorability: Is it possible that the vertices of a given
  graph be assigned one of two colors, such that no edge connects
  vertices of the same color? (Note: this is equivalent to the
  question: is $G$ bipartite?))
  \vspace{8cm}
\end{enumerate} 


\newpage
\section*{Directed graphs (digraphs)}

\subsection*{Concepts:}

\begin{itemize}

\item Reachability 

\item Directed paths and directed cycles 

\item Strongly connected components (SCC)

\item Directly acyclic graphs (DAGs) and topological ordering

\item Transitive closure (TC)
\end{itemize} 



\subsection*{Basic problems on directed graphs:}

Briefly describe algorithms to answer the following questions, and
analyze the complexity of your algorithm. Assume the graph is given as
an adjacency list.
\begin{enumerate}

\item Find all verties reachable from a given vertex $u$. 
\vspace{5cm}

\item Given a vertex $u$, compute all vertices $v$ such that $u$ is
  reachable from $v$.  \vspace{5cm}

\item Given two vertices $u,v$, is there a (directed) path from $u$ to
  $v$?  If so, find such a path. \vspace{5cm}

\item Given two vertices $u,v$, is there a (directed) path from $u$ to
  $v$?  If so, find such a \emph{shortest} such path.
\vspace{5cm}

\item Does $G$ have a directed cycle? 
\vspace{5cm}

\item Is $G$ a DAG? (ie is $G$ acyclic?)
\vspace{5cm}

\newpage
\item All-pair reachability: Given a graph, support queries of the
  form: given $u,v$, is $v$ reachable from $u$? (a) no pre-precessing;
  (b) with pre-precessing, in $O(1)$ time per query; 
\vspace{8cm}

%%\item Compute the transitive closure of $G$. 

\item Are two vertices $u,v$ in the same SCC? 
\vspace{5cm}

\item Compute the SCCs of $G$ (label each vertex with the id of its SCC).
\vspace{5cm}



\vspace{5cm}
\end{enumerate} 

\end{document}
